Message ID | 578AE85D.2030903@gmail.com |
---|---|
State | New |
Headers | show |
On 07/17/2016 11:52 AM, Manuel López-Ibáñez wrote: > On 15/07/16 18:05, Aldy Hernandez wrote: > > + case OPT_Walloca_larger_than_: > + if (!value) > + inform (loc, "-Walloca-larger-than=0 is meaningless"); > + break; > + > + case OPT_Wvla_larger_than_: > + if (!value) > + inform (loc, "-Wvla-larger-than=0 is meaningless"); > + break; > + > > We don't give similar notes for any of the other Wx-larger-than= > options. If -Wvla-larger-than=0 suppresses a previous > -Wvla-larger-than=, then it doesn't seem meaningless, but a useful thing > to have. I'm trying to avoid confusing users that may think that -Walloca-larger-than=0 means warn on any use of alloca. That is what -Walloca is for. But really, I don't care. If you feel strongly about it, I can just remove the block of code. Aldy
On 07/17/2016 09:52 AM, Manuel López-Ibáñez wrote: > + if (is_vla) > + gcc_assert (warn_vla_limit > 0); > + if (!is_vla) > + gcc_assert (warn_alloca_limit > 0); > > if-else ? Or perhaps: Shouldn't really matter, except perhaps in a -O0 compilation. Though I think else-if makes it slightly clearer. > > gcc_assert (!is_vla || warn_vla_limit > 0); > gcc_assert (is_vla || warn_alloca_limit > 0); Would be acceptable as well. I think any of the 3 is fine and leave it to Aldy's discretion which to use. Jeff
On 19 July 2016 at 18:47, Jeff Law <law@redhat.com> wrote: > On 07/17/2016 09:52 AM, Manuel López-Ibáñez wrote: >> >> + if (is_vla) >> + gcc_assert (warn_vla_limit > 0); >> + if (!is_vla) >> + gcc_assert (warn_alloca_limit > 0); >> >> if-else ? Or perhaps: > > Shouldn't really matter, except perhaps in a -O0 compilation. Though I > think else-if makes it slightly clearer. Of course, I mentioned it because of clarity. It was difficult to distinguish !i versus (i in my screen and I had to stop to read it again. Cheers, Manuel.
On 07/19/2016 01:47 PM, Jeff Law wrote: > On 07/17/2016 09:52 AM, Manuel López-Ibáñez wrote: >> + if (is_vla) >> + gcc_assert (warn_vla_limit > 0); >> + if (!is_vla) >> + gcc_assert (warn_alloca_limit > 0); >> >> if-else ? Or perhaps: > Shouldn't really matter, except perhaps in a -O0 compilation. Though I > think else-if makes it slightly clearer. > >> My preference would've been the if/else. The missing else was an oversight. However, since I really don't care, the last posted patch uses this: >> gcc_assert (!is_vla || warn_vla_limit > 0); >> gcc_assert (is_vla || warn_alloca_limit > 0); > Would be acceptable as well. I think any of the 3 is fine and leave it > to Aldy's discretion which to use. > > Jeff
--- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -275,6 +275,15 @@ Wall C ObjC C++ ObjC++ Warning Enable most warning messages. +Walloca +C ObjC C++ ObjC++ Var(warn_alloca) Warning + +Walloca-larger-than= +C ObjC C++ ObjC++ Var(warn_alloca_limit) Warning Joined RejectNegative UInteger +-Walloca-larger-than=<number> Warn on unbounded uses of +alloca, and on bounded uses of alloca whose bound can be larger than +<number> bytes. No description for Walloca. + if (warn_alloca)