* c-opts.c (warn_variadic_macros): New.
(c_common_handle_option): Set it.
(sanitize_cpp_opts): Copy it to cpp_opts.
* c.opt (Wvariadic-macros): New.
* cpplib.h (struct cpp_options): Add warn_variadic_macros.
* cppinit.c (cpp_create_reader): Initialize it.
* cppmacro.c (parse_params): Check it.
From-SVN: r78125
+2004-02-19 Richard Henderson <rth@redhat.com>
+
+ * c-opts.c (warn_variadic_macros): New.
+ (c_common_handle_option): Set it.
+ (sanitize_cpp_opts): Copy it to cpp_opts.
+ * c.opt (Wvariadic-macros): New.
+ * cpplib.h (struct cpp_options): Add warn_variadic_macros.
+ * cppinit.c (cpp_create_reader): Initialize it.
+ * cppmacro.c (parse_params): Check it.
+
2004-02-19 David Daney <ddaney@avtrex.com>
PR preprocessor/14198
/* If -Wunused-macros. */
static bool warn_unused_macros;
+/* If -Wvariadic-macros. */
+static bool warn_variadic_macros = true;
+
/* Number of deferred options. */
static size_t deferred_count;
warn_unused_macros = value;
break;
+ case OPT_Wvariadic_macros:
+ warn_variadic_macros = value;
+ break;
+
case OPT_Wwrite_strings:
if (!c_dialect_cxx ())
flag_const_strings = value;
cpp_opts->warn_long_long
= warn_long_long && ((!flag_isoc99 && pedantic) || warn_traditional);
+ /* Similarly with -Wno-variadic-macros. No check for c99 here, since
+ this also turns off warnings about GCCs extension. */
+ cpp_opts->warn_variadic_macros
+ = warn_variadic_macros && (pedantic || warn_traditional);
+
/* If we're generating preprocessor output, emit current directory
if explicitly requested or if debugging information is enabled.
??? Maybe we should only do it for debugging formats that
C ObjC C++ ObjC++
Warn about macros defined in the main file that are not used
+Wvariadic-macros
+C ObjC C++ ObjC++
+Do not warn about using variadic macros when -pedantic
+
Wwrite-strings
C ObjC C++ ObjC++
Give strings the type \"array of char\"
CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99);
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, warn_dollars) = 1;
+ CPP_OPTION (pfile, warn_variadic_macros) = 1;
/* Default CPP arithmetic to something sensible for the host for the
benefit of dumb users like fix-header. */
promotions. */
unsigned char warn_num_sign_change;
+ /* Zero means don't warn about __VA_ARGS__ usage in c89 pedantic mode.
+ Presumably the usage is protected by the appropriate #ifdef. */
+ unsigned char warn_variadic_macros;
+
/* Nonzero means turn warnings into errors. */
unsigned char warnings_are_errors;
_cpp_save_parameter (pfile, macro,
pfile->spec_nodes.n__VA_ARGS__);
pfile->state.va_args_ok = 1;
- if (! CPP_OPTION (pfile, c99) && CPP_OPTION (pfile, pedantic))
+ if (! CPP_OPTION (pfile, c99)
+ && CPP_OPTION (pfile, pedantic)
+ && CPP_OPTION (pfile, warn_variadic_macros))
cpp_error (pfile, CPP_DL_PEDWARN,
"anonymous variadic macros were introduced in C99");
}
- else if (CPP_OPTION (pfile, pedantic))
+ else if (CPP_OPTION (pfile, pedantic)
+ && CPP_OPTION (pfile, warn_variadic_macros))
cpp_error (pfile, CPP_DL_PEDWARN,
"ISO C does not permit named variadic macros");