summaryrefslogtreecommitdiff
path: root/gcc/opth-gen.awk
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-09 22:17:54 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-09 22:17:54 +0000
commit7ff8db3160d75a769c2a811f799e957788c6151e (patch)
tree41ca6a27e407c630dc4967e1c13f17fe6e01bf14 /gcc/opth-gen.awk
parentbcc1f37e9992f610b88da36d92b0f56919865172 (diff)
downloadgcc-7ff8db3160d75a769c2a811f799e957788c6151e.tar.gz
gcc/ChangeLog:
2014-09-09 Manuel López-Ibáñez <manu@gcc.gnu.org> * opth-gen.awk: Generate mapping from cpp message reasons to the options that enable them. * doc/options.texi (CppReason): Document. gcc/c-family/ChangeLog: 2014-09-09 Manuel López-Ibáñez <manu@gcc.gnu.org> * c.opt: Add CppReason to various flags. (Wdate-time): Re-sort. * c-common.c: Include c-common.h earlier. (struct reason_option_codes_t): Delete. (c_option_controlling_cpp_error): Prefix global type and struct with cpp_. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215095 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opth-gen.awk')
-rw-r--r--gcc/opth-gen.awk27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 4e8f21f406b..cbc7ab53b88 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -479,5 +479,32 @@ print " OPT_SPECIAL_program_name,"
print " OPT_SPECIAL_input_file"
print "};"
print ""
+print "#ifdef GCC_C_COMMON_H"
+print "/* Mapping from cpp message reasons to the options that enable them. */"
+print "#include <cpplib.h>"
+print "struct cpp_reason_option_codes_t"
+print "{"
+print " const int reason; /* cpplib message reason. */"
+print " const int option_code; /* gcc option that controls this message. */"
+print "};"
+print ""
+print "static const struct cpp_reason_option_codes_t cpp_reason_option_codes[] = {"
+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_reason = nth_arg(0, opt_args("CppReason", flags[i]));
+ if (cpp_reason != "") {
+ cpp_reason = cpp_reason ",";
+ printf(" {%-40s %s},\n", cpp_reason, opt_enum(opts[i]))
+ }
+}
+printf(" {%-40s 0},\n", "CPP_W_NONE,")
+print "};"
+print "#endif"
+print ""
print "#endif /* OPTIONS_H */"
}