public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
To: Paolo Bonzini <bonzini@gnu.org>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] cpp/c: Add -Wexpansion-to-defined
Date: Tue, 09 Aug 2016 18:30:00 -0000	[thread overview]
Message-ID: <a18435f3-2c8e-6d77-a834-abc6c35e9ce1@gmail.com> (raw)
In-Reply-To: <1470758390-42725-1-git-send-email-bonzini@gnu.org>

On 09/08/16 16:59, Paolo Bonzini wrote:
> Index: gcc/c-family/c-opts.c
> ===================================================================
> --- gcc/c-family/c-opts.c	(revision 239276)
> +++ gcc/c-family/c-opts.c	(working copy)
> @@ -1256,6 +1256,10 @@ sanitize_cpp_opts (void)
>    cpp_opts->unsigned_char = !flag_signed_char;
>    cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
>
> +  cpp_opts->warn_expansion_to_defined = cpp_warn_expansion_to_defined;
> +  if (cpp_warn_expansion_to_defined == -1)
> +    cpp_warn_expansion_to_defined = pedantic || extra_warnings;
> +

Instead of the above, plase use LangEnabledBy() or EnabledBy() in c.opt. See 
Wendif-labels and other examples. Then, you do not need Init(-1).

>    /* Wlong-long is disabled by default. It is enabled by:
>        [-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or
>        [-Wpedantic | -Wtraditional] -std=non-c99
> Index: gcc/c-family/c.opt
> ===================================================================
> --- gcc/c-family/c.opt	(revision 239276)
> +++ gcc/c-family/c.opt	(working copy)
> @@ -506,6 +506,10 @@ Wdouble-promotion
>  C ObjC C++ ObjC++ Var(warn_double_promotion) Warning
>  Warn about implicit conversions from \"float\" to \"double\".
>
> +Wexpansion-to-defined
> +C ObjC C++ ObjC++ CppReason(CPP_W_EXPANSION_TO_DEFINED) Var(cpp_warn_expansion_to_defined) Init(-1) Warning
> +Warn if an undefined macro is used in an #if directive.
> +

You are also missing CPP(warn_expansion_to_defined) so that the cpp and gcc 
sides are in sync even when using pragmas.

Cheers,

	Manuel.

  reply	other threads:[~2016-08-09 18:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 16:00 Paolo Bonzini
2016-08-09 18:30 ` Manuel López-Ibáñez [this message]
2016-08-09 21:21   ` Paolo Bonzini
2016-08-10  0:49     ` Manuel López-Ibáñez
2016-08-10  8:45       ` Paolo Bonzini
2016-08-09 18:44 ` Eric Gallager
2016-08-09 21:35   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a18435f3-2c8e-6d77-a834-abc6c35e9ce1@gmail.com \
    --to=lopezibanez@gmail.com \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).