public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Martin Sebor <msebor@redhat.com>, Jeff Law <law@redhat.com>
Cc: Andrew MacLeod <amacleod@redhat.com>
Subject: Re: RFA: new pass to warn on questionable uses of alloca() and VLAs
Date: Sun, 10 Jul 2016 23:41:00 -0000	[thread overview]
Message-ID: <5782DD2B.4030505@gmail.com> (raw)
In-Reply-To: <577F9301.10205@redhat.com>

> +Walloca
> +LangEnabledBy(C ObjC C++ ObjC++)
> +; in common.opt
> +
> +Walloca=
> +LangEnabledBy(C ObjC C++ ObjC++)
> +; in common.opt
> +

I'm not sure what you think the above means, but this is an invalid use of 
LangEnabledBy(). (It would be nice if the .awk scripts were able to catch it 
and give an error.)


> +;; warn_vla == 0 for -Wno-vla
> +;; warn_vla == -1 for nothing passed.
> +;; warn_vla == -2 for -Wvla passed
> +;; warn_vla == NUM for -Wvla=NUM
>  Wvla
>  C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning
>  Warn if a variable length array is used.
>
> +Wvla=
> +C ObjC C++ ObjC++ Var(warn_vla) Warning Joined RejectNegative UInteger
> +-Wvla=<number> Warn on unbounded uses of variable-length arrays, and
> +warn on bounded uses of variable-length arrays whose bound can be
> +larger than <number> bytes.
> +

This overloading of warn_vla seems confusing (as shown by all the places that 
require updating). Why not call it Wvla-larger-than= and use a different 
warn_vla_larger_than variable? We already have -Wlarger-than= and 
-Wframe-larger-than=.

Using warn_vla_larger_than (even if you wish to keep -Wvla= as the option name) 
as a variable distinct from warn_vla would make things simpler:

-Wvla => warn_vla == 1
-Wno-vla => warn_vla == 0
-Wvla=N => warn_vla_larger_than == N (where N == 0 means disable).

If you wish that -Wno-vla implies -Wvla=0 then you'll need to handle that 
manually. I don't think we have support for that in the .opt files. But that 
seems far less complex than having a single shared Var().

Cheers,
	Manuel.

  parent reply	other threads:[~2016-07-10 23:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 11:48 Aldy Hernandez
2016-07-10 22:09 ` Martin Sebor
2016-07-11 14:32   ` Jeff Law
2016-07-15 17:05   ` Aldy Hernandez
2016-07-16 21:08     ` Martin Sebor
2016-07-16 23:59       ` Martin Sebor
2016-07-18 10:45       ` Aldy Hernandez
2016-07-19  3:14         ` Martin Sebor
2016-07-19 11:03           ` Aldy Hernandez
2016-07-19 17:54             ` Jeff Law
2016-07-19 19:06               ` Aldy Hernandez
2016-08-01 20:35             ` Joseph Myers
2016-08-02 12:55               ` Aldy Hernandez
2016-07-17 15:53     ` Manuel López-Ibáñez
2016-07-18 10:10       ` Aldy Hernandez
2016-07-19 17:47       ` Jeff Law
2016-07-19 18:07         ` Manuel López-Ibáñez
2016-07-19 19:05         ` Aldy Hernandez
2016-07-10 23:41 ` Manuel López-Ibáñez [this message]
2016-07-11 10:10   ` Aldy Hernandez
2016-07-11 14:22     ` Manuel López-Ibáñez
2016-07-11 15:08     ` Martin Sebor
2016-07-11 15:40       ` Aldy Hernandez
2016-07-11 17:56         ` Martin Sebor
2016-07-15 17:05           ` Aldy Hernandez
2016-07-11 14:25 ` Jeff Law

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=5782DD2B.4030505@gmail.com \
    --to=lopezibanez@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=msebor@redhat.com \
    /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).