summaryrefslogtreecommitdiff
path: root/gcc/optc-gen.awk
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-19 22:37:49 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-19 22:37:49 +0000
commit3636964b97fe3f095c06e7f4456887edcd5bacde (patch)
tree75764dc68d3b47da1315519f474d62d5a2262f04 /gcc/optc-gen.awk
parent2108e7ffbf81b5d43a5f80df8227b77ed67d2d6c (diff)
downloadgcc-3636964b97fe3f095c06e7f4456887edcd5bacde.tar.gz
gcc/ChangeLog:
2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/60975 PR c/53063 * doc/options.texi (CPP): Document it. * doc/invoke.texi (Wvariadic-macros): Fix documentation. * optc-gen.awk: Handle CPP. * opth-gen.awk: Likewise. gcc/c-family/ChangeLog: 2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/60975 PR c/53063 * c.opt (Wvariadic-macros): Use CPP and LangEnabledBy. * c-opts.c (c_common_handle_option): Call cpp_handle_option_auto. (c_common_post_options): Call init_global_opts_from_cpp. (sanitize_cpp_opts): Do not handle Wvariadic-macros here. gcc/testsuite/ChangeLog: 2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/60975 PR c/53063 * gcc.dg/cpp/Wvariadic-1p.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214200 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optc-gen.awk')
-rw-r--r--gcc/optc-gen.awk51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index b70e4fe3aad..ef80c99b6dc 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -480,4 +480,55 @@ for (i = 0; i < n_langs; i++) {
print "} "
}
+#Handle CPP()
+print "\n"
+print "#include " quote "cpplib.h" quote;
+print "void"
+print "cpp_handle_option_auto (const struct gcc_options * opts, "
+print " size_t scode, struct cpp_options * cpp_opts)"
+print "{ "
+print " enum opt_code code = (enum opt_code) scode; "
+print " "
+print " switch (code) "
+print " { "
+for (i = 0; i < n_opts; i++) {
+ # With identical flags, pick only the last one. The
+ # earlier loop ensured that it has all flags merged,
+ # and a nonempty help text if one of the texts was nonempty.
+ while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
+ i++;
+ }
+
+ cpp_option = nth_arg(0, opt_args("CPP", flags[i]));
+ opt_var_name = var_name(flags[i]);
+ if (cpp_option != "" && opt_var_name != "") {
+ print " case " opt_enum(opts[i]) ":"
+ print " cpp_opts->" cpp_option " = opts->x_" opt_var_name ";"
+ print " break;"
+ }
}
+print " default: "
+print " break; "
+print " } "
+print "}\n"
+print "void"
+print "init_global_opts_from_cpp(struct gcc_options * opts, "
+print " const struct cpp_options * cpp_opts)"
+print "{ "
+for (i = 0; i < n_opts; i++) {
+ # With identical flags, pick only the last one. The
+ # earlier loop ensured that it has all flags merged,
+ # and a nonempty help text if one of the texts was nonempty.
+ while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
+ i++;
+ }
+ cpp_option = nth_arg(0, opt_args("CPP", flags[i]));
+ opt_var_name = var_name(flags[i]);
+ if (cpp_option != "" && opt_var_name != "") {
+ print " opts->x_" opt_var_name " = cpp_opts->" cpp_option ";"
+ }
+}
+print "} "
+
+}
+