diff mbox series

Move -Walloca and related warnings from c.opt to common.opt

Message ID CABOHX+c3NmK9+uDroAAzE_Pi_ginuL-ADCwtYaez4p69q+714A@mail.gmail.com
State New
Headers show
Series Move -Walloca and related warnings from c.opt to common.opt | expand

Commit Message

Iain Buclaw July 29, 2018, 6:35 p.m. UTC
Hi,

Since r262910, it was noticed that new -Walloca-larger-than= warnings
started appearing when building the D frontend's standard library.
These have been checked and verified as valid, and appropriate fixes
will be sent on upstream.

As for the warning itself, as it is now default on, it would be
preferable to be able control it.  Given the choice between adding
these options to the D frontend or moving them to common, I'd rather
move them to common.

Regards
Iain.

---

Comments

Jakub Jelinek July 30, 2018, 3:28 p.m. UTC | #1
On Sun, Jul 29, 2018 at 08:35:39PM +0200, Iain Buclaw wrote:
> Since r262910, it was noticed that new -Walloca-larger-than= warnings
> started appearing when building the D frontend's standard library.
> These have been checked and verified as valid, and appropriate fixes
> will be sent on upstream.
> 
> As for the warning itself, as it is now default on, it would be
> preferable to be able control it.  Given the choice between adding
> these options to the D frontend or moving them to common, I'd rather
> move them to common.

It is strange to add a warning option for languages that don't even have
alloca.  Instead, the warning shouldn't be enabled by default (but Martin
doesn't want to listen to that), or at least should be enabled only for the
languages where it makes sense.

	Jakub
Martin Sebor July 30, 2018, 3:45 p.m. UTC | #2
On 07/30/2018 09:28 AM, Jakub Jelinek wrote:
> On Sun, Jul 29, 2018 at 08:35:39PM +0200, Iain Buclaw wrote:
>> Since r262910, it was noticed that new -Walloca-larger-than= warnings
>> started appearing when building the D frontend's standard library.
>> These have been checked and verified as valid, and appropriate fixes
>> will be sent on upstream.
>>
>> As for the warning itself, as it is now default on, it would be
>> preferable to be able control it.  Given the choice between adding
>> these options to the D frontend or moving them to common, I'd rather
>> move them to common.
>
> It is strange to add a warning option for languages that don't even have
> alloca.  Instead, the warning shouldn't be enabled by default (but Martin
> doesn't want to listen to that), or at least should be enabled only for the
> languages where it makes sense.

I agree that the warning shouldn't be enabled for languages that
don't have support for alloca.

Martin
Iain Buclaw July 30, 2018, 9:25 p.m. UTC | #3
On 30 July 2018 at 17:45, Martin Sebor <msebor@gmail.com> wrote:
> On 07/30/2018 09:28 AM, Jakub Jelinek wrote:
>>
>> On Sun, Jul 29, 2018 at 08:35:39PM +0200, Iain Buclaw wrote:
>>>
>>> Since r262910, it was noticed that new -Walloca-larger-than= warnings
>>> started appearing when building the D frontend's standard library.
>>> These have been checked and verified as valid, and appropriate fixes
>>> will be sent on upstream.
>>>
>>> As for the warning itself, as it is now default on, it would be
>>> preferable to be able control it.  Given the choice between adding
>>> these options to the D frontend or moving them to common, I'd rather
>>> move them to common.
>>
>>
>> It is strange to add a warning option for languages that don't even have
>> alloca.  Instead, the warning shouldn't be enabled by default (but Martin
>> doesn't want to listen to that), or at least should be enabled only for
>> the
>> languages where it makes sense.
>
>
> I agree that the warning shouldn't be enabled for languages that
> don't have support for alloca.
>

Fair enough, I'll add them to D instead then.

I am curious though if its possible to trigger warnings from languages
that don't have direct support for alloca.  However having a look, the
only places that generate a call to alloca deal with variable-sized
objects.

Iain.
diff mbox series

Patch

gcc/ChangeLog

	* common.opt (-Walloca): Moved from common.opt.
	(Walloca-larger-than=): Likewise.
	(Wno-alloca-larger-than): Likewise.

gcc/c-family/ChangeLog

	* c.opt (-Walloca): Move to common.opt.
	(Walloca-larger-than=): Likewise.
	(Wno-alloca-larger-than): Likewise.

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index d6148380710..67da5a9e401 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -299,10 +299,6 @@  Wall
 C ObjC C++ ObjC++ Warning
Enable most warning messages.
 
-Walloca
-C ObjC C++ ObjC++ Var(warn_alloca) Warning
-Warn on any use of alloca.
-
 Walloc-size-larger-than=
 C ObjC C++ LTO ObjC++ Var(warn_alloc_size_limit) Joined Host_Wide_Int ByteSize Warning Init(HOST_WIDE_INT_MAX)
 -Walloc-size-larger-than=<bytes> Warn for calls to allocation functions that
@@ -316,16 +312,6 @@  Walloc-zero
 C ObjC C++ ObjC++ Var(warn_alloc_zero) Warning
 -Walloc-zero Warn for calls to allocation functions that specify zero bytes.
 
-Walloca-larger-than=
-C ObjC C++ LTO ObjC++ Var(warn_alloca_limit) Warning Joined Host_Wide_Int ByteSize Init(HOST_WIDE_INT_MAX)
--Walloca-larger-than=<number>	Warn on unbounded uses of
-alloca, and on bounded uses of alloca whose bound can be larger than
-<number> bytes.
-
-Wno-alloca-larger-than
-C ObjC C++ LTO ObjC++ Alias(Walloca-larger-than=,18446744073709551615EiB,none) Warning
--Wno-alloca-larger-than Disable Walloca-larger-than= warning.  Equivalent to Walloca-larger-than=<SIZE_MAX> or larger.
-
 Warray-bounds
 LangEnabledBy(C ObjC C++ LTO ObjC++)
 ; in common.opt
diff --git a/gcc/common.opt b/gcc/common.opt
index 4bf8de90331..fa68eda4213 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -538,6 +538,20 @@  Waggressive-loop-optimizations
 Common Var(warn_aggressive_loop_optimizations) Init(1) Warning
 Warn if a loop with constant number of iterations triggers undefined behavior.
 
+Walloca
+Common Var(warn_alloca) Warning
+Warn on any use of alloca.
+
+Walloca-larger-than=
+Common Var(warn_alloca_limit) Warning Joined Host_Wide_Int ByteSize Init(HOST_WIDE_INT_MAX)
+-Walloca-larger-than=<number>	Warn on unbounded uses of
+alloca, and on bounded uses of alloca whose bound can be larger than
+<number> bytes.
+
+Wno-alloca-larger-than
+Common Alias(Walloca-larger-than=,18446744073709551615EiB,none) Warning
+-Wno-alloca-larger-than Disable Walloca-larger-than= warning.  Equivalent to Walloca-larger-than=<SIZE_MAX> or larger.
+
 Warray-bounds
 Common Var(warn_array_bounds) Warning
 Warn if an array is accessed out of bounds.