diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 9 | ||||
-rw-r--r-- | libcpp/charset.c | 2 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 2 | ||||
-rw-r--r-- | libcpp/lex.c | 2 | ||||
-rw-r--r-- | libcpp/macro.c | 6 |
5 files changed, 15 insertions, 6 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 54581dd..a173909b 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,12 @@ +2014-08-19 Marek Polacek <polacek@redhat.com> + + * charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat. + * lex.c (_cpp_lex_direct): Likewise. + * macro.c (replace_args): Likewise. + (parse_params): Likewise. + * include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat + to char. + 2014-08-10 Marek Polacek <polacek@redhat.com> PR c/51849 diff --git a/libcpp/charset.c b/libcpp/charset.c index fa46f92..07a594d 100644 --- a/libcpp/charset.c +++ b/libcpp/charset.c @@ -995,7 +995,7 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99)) cpp_error (pfile, CPP_DL_WARNING, "universal character names are only valid in C++ and C99"); - else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 && !CPP_OPTION (pfile, cplusplus)) cpp_error (pfile, CPP_DL_WARNING, "C99's universal character names are incompatible with C90"); diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 4cd66cd..b89ba20 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -467,7 +467,7 @@ struct cpp_options bool restore_pch_deps; /* True if warn about differences between C90 and C99. */ - bool cpp_warn_c90_c99_compat; + char cpp_warn_c90_c99_compat; /* Dependency generation. */ struct diff --git a/libcpp/lex.c b/libcpp/lex.c index 5cc2224..0713f65 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -2337,7 +2337,7 @@ _cpp_lex_direct (cpp_reader *pfile) buffer->warned_cplusplus_comments = 1; } /* Or if specifically desired via -Wc90-c99-compat. */ - else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 && ! buffer->warned_cplusplus_comments) { cpp_error (pfile, CPP_DL_WARNING, diff --git a/libcpp/macro.c b/libcpp/macro.c index ff6685c..a1ba137 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1787,7 +1787,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, " in ISO C++98", NODE_NAME (node), src->val.macro_arg.arg_no); - else + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat)) cpp_error (pfile, CPP_DL_PEDWARN, "invoking macro %s argument %d: " "empty macro arguments are undefined" @@ -1795,7 +1795,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, NODE_NAME (node), src->val.macro_arg.arg_no); } - else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 && ! macro->syshdr && ! cpp_in_system_header (pfile) && ! CPP_OPTION (pfile, cplusplus)) @@ -2858,7 +2858,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) (pfile, CPP_W_VARIADIC_MACROS, "anonymous variadic macros were introduced in C99"); } - else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 && ! CPP_OPTION (pfile, cplusplus)) cpp_error (pfile, CPP_DL_WARNING, "anonymous variadic macros were introduced in C99"); |