This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -Wvariadic-macros does not print warning


On 04/29/14 08:14, Prathamesh Kulkarni wrote:
On Tue, Apr 29, 2014 at 7:37 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
On Tue, Apr 29, 2014 at 6:49 PM, Manuel López-Ibáñez
<lopezibanez@gmail.com> wrote:
This hunk in your patch doesn't seem related:
Oops, Sorry. Removed that, and re-tested.

@@ -509,6 +509,9 @@ Warn about missing fields in struct init
  Wsizeof-pointer-memaccess
  C ObjC C++ ObjC++ Var(warn_sizeof_pointer_memaccess) Warning
LangEnabledBy(C ObjC C++ ObjC++,Wall)

+Wsizeof-array-argument
+C Var(warn_sizeof_array_argument) Warning LangEnabledBy(C,Wall)
+
  Wsuggest-attribute=format
  C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning
  Warn about functions which might be candidates for format attributes

Also, it would be good to update doc/invoke.texi, the current
description is a bit confusing. It says it is enabled by default when
it actually isn't (nor after your patch). I propose something like:


Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 208669)
+++ gcc/doc/invoke.texi (working copy)
@@ -4997,9 +4997,10 @@
  @item -Wvariadic-macros
  @opindex Wvariadic-macros
  @opindex Wno-variadic-macros
-Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
-alternate syntax when in pedantic ISO C99 mode.  This is default.
-To inhibit the warning messages, use @option{-Wno-variadic-macros}.
+Warn if variadic macros are used in ISO C90 mode, or if the GNU
+alternate syntax is used in ISO C99 mode.  This is enabled by either
+@option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
+messages, use @option{-Wno-variadic-macros}.

  @item -Wvarargs
  @opindex Wvarargs
Thanks. I added this to the patch.

On 29 April 2014 14:41, Prathamesh Kulkarni <bilbotheelffriend@gmail.com> wrote:

Is this version OK ?

[libcpp]
* macro.c (parse_params): Remove check for Wpedantic for variadic macros.

[gcc/c-family]
* c.opt (-Wvariadic-macros): Init(-1) instead of Init(1).
* c-opts.c (c_common_handle_option): Add case OPT_Wvariadic_macros.
                (sanitize_cpp_opts): Check condition for pedantic or
warn_traditional.

[gcc/testsuite/gcc.dg/cpp]
* Wvariadic-5.c: New test-case.

[gcc/doc]
* invoke.text: Change documentation for Wvariadic-macros option.
Sorry for the spelling mistake. Re-posting the changelog.

[libcpp]
* macro.c (parse_params): Remove check for Wpedantic for variadic macros.

[gcc/c-family]
* c.opt (-Wvariadic-macros): Init(-1) instead of Init(1).
* c-opts.c (c_common_handle_option): Add case OPT_Wvariadic_macros.
                (sanitize_cpp_opts): Check condition for pedantic or
warn_traditional.

[gcc/testsuite/gcc.dg/cpp]
* Wvariadic-5.c: New test-case.

[gcc/doc]
* invoke.texi (-Wvariadic-macros): Change documentation for
-Wvariadic-macros option.
This is fine. When you commit the change, make sure that your ChangeLog entry follows the same formatting as the others.

Thanks,
Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]