public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* committed: remove redundant -Wall from -Warray-bounds (PR 82063)
@ 2018-07-20 21:22 Martin Sebor
  2018-07-24  9:24 ` Franz Sirl
  2022-03-29  9:23 ` options: Remove 'gcc/c-family/c.opt:Warray-bounds' option definition record (was: committed: remove redundant -Wall from -Warray-bounds (PR 82063)) Thomas Schwinge
  0 siblings, 2 replies; 7+ messages in thread
From: Martin Sebor @ 2018-07-20 21:22 UTC (permalink / raw)
  To: Gcc Patch List

As the last observation in PR 82063 Jim points out that

   Both -Warray-bounds and -Warray-bounds= are listed in the c.opt
   file as being enabled by -Wall, but they are the same option,
   and it causes this one option to be processed twice in the
   C_handle_option_auto function in the generated options.c file.
   It gets set to the same value twice, so it does work as intended,
   but this is wasteful.

I have removed the redundant -Wall from the first option and
committed the change as obvious in r262912.

Martin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: committed: remove redundant -Wall from -Warray-bounds (PR 82063)
  2018-07-20 21:22 committed: remove redundant -Wall from -Warray-bounds (PR 82063) Martin Sebor
@ 2018-07-24  9:24 ` Franz Sirl
  2018-07-24 15:36   ` Martin Sebor
  2022-03-29  9:23 ` options: Remove 'gcc/c-family/c.opt:Warray-bounds' option definition record (was: committed: remove redundant -Wall from -Warray-bounds (PR 82063)) Thomas Schwinge
  1 sibling, 1 reply; 7+ messages in thread
From: Franz Sirl @ 2018-07-24  9:24 UTC (permalink / raw)
  To: Martin Sebor, Gcc Patch List

Am 2018-07-20 um 23:22 schrieb Martin Sebor:
> As the last observation in PR 82063 Jim points out that
> 
>    Both -Warray-bounds and -Warray-bounds= are listed in the c.opt
>    file as being enabled by -Wall, but they are the same option,
>    and it causes this one option to be processed twice in the
>    C_handle_option_auto function in the generated options.c file.
>    It gets set to the same value twice, so it does work as intended,
>    but this is wasteful.
> 
> I have removed the redundant -Wall from the first option and
> committed the change as obvious in r262912.

Hi Martin,

this looks related to PR 68845 and my patch in there. I never posted it 
to gcc-patches because I couldn't find a definitive answer on how 
options duplicated between common.opt and c-family/c.opt are supposed to 
be handled.
For example, Warray-bounds in common.opt is a separate option (not an 
alias to Warray-bounds=), leading to separate enums for them. Is this 
intended? Warray-bounds seemed to be the only option with an equal sign 
doing it like that at that time. Now Wcast-align is doing the same...

Can you shed some light on this?

Franz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: committed: remove redundant -Wall from -Warray-bounds (PR 82063)
  2018-07-24  9:24 ` Franz Sirl
@ 2018-07-24 15:36   ` Martin Sebor
  2018-07-24 19:48     ` Franz Sirl
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Sebor @ 2018-07-24 15:36 UTC (permalink / raw)
  To: Franz Sirl, Gcc Patch List

On 07/24/2018 03:24 AM, Franz Sirl wrote:
> Am 2018-07-20 um 23:22 schrieb Martin Sebor:
>> As the last observation in PR 82063 Jim points out that
>>
>>    Both -Warray-bounds and -Warray-bounds= are listed in the c.opt
>>    file as being enabled by -Wall, but they are the same option,
>>    and it causes this one option to be processed twice in the
>>    C_handle_option_auto function in the generated options.c file.
>>    It gets set to the same value twice, so it does work as intended,
>>    but this is wasteful.
>>
>> I have removed the redundant -Wall from the first option and
>> committed the change as obvious in r262912.
>
> Hi Martin,
>
> this looks related to PR 68845 and my patch in there. I never posted it
> to gcc-patches because I couldn't find a definitive answer on how
> options duplicated between common.opt and c-family/c.opt are supposed to
> be handled.
> For example, Warray-bounds in common.opt is a separate option (not an
> alias to Warray-bounds=), leading to separate enums for them. Is this
> intended? Warray-bounds seemed to be the only option with an equal sign
> doing it like that at that time. Now Wcast-align is doing the same...
>
> Can you shed some light on this?

-Warray-bounds= (the form that takes an argument) was added in
r219577.  Before then, only the plain form existed.  If I had
to guess, the interplay between the two options (as opposed to
making the latter an alias for the new option) wasn't considered.
I didn't think of it until now either.  Your patch seems like
the right solution to me.  Let me know if you will submit it.
If not, I posted the patch below that touches this area and
that will likely need updating so I can roll your change into
it:

https://gcc.gnu.org/ml/gcc-patches/2018-07/msg01286.html

Martin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: committed: remove redundant -Wall from -Warray-bounds (PR 82063)
  2018-07-24 15:36   ` Martin Sebor
@ 2018-07-24 19:48     ` Franz Sirl
  2018-07-24 20:18       ` Martin Sebor
  0 siblings, 1 reply; 7+ messages in thread
From: Franz Sirl @ 2018-07-24 19:48 UTC (permalink / raw)
  To: Martin Sebor, Gcc Patch List

Am 2018-07-24 um 17:35 schrieb Martin Sebor:
> On 07/24/2018 03:24 AM, Franz Sirl wrote:
>> Am 2018-07-20 um 23:22 schrieb Martin Sebor:
>>> As the last observation in PR 82063 Jim points out that
>>>
>>>    Both -Warray-bounds and -Warray-bounds= are listed in the c.opt
>>>    file as being enabled by -Wall, but they are the same option,
>>>    and it causes this one option to be processed twice in the
>>>    C_handle_option_auto function in the generated options.c file.
>>>    It gets set to the same value twice, so it does work as intended,
>>>    but this is wasteful.
>>>
>>> I have removed the redundant -Wall from the first option and
>>> committed the change as obvious in r262912.
>>
>> Hi Martin,
>>
>> this looks related to PR 68845 and my patch in there. I never posted it
>> to gcc-patches because I couldn't find a definitive answer on how
>> options duplicated between common.opt and c-family/c.opt are supposed to
>> be handled.
>> For example, Warray-bounds in common.opt is a separate option (not an
>> alias to Warray-bounds=), leading to separate enums for them. Is this
>> intended? Warray-bounds seemed to be the only option with an equal sign
>> doing it like that at that time. Now Wcast-align is doing the same...
>>
>> Can you shed some light on this?
> 
> -Warray-bounds= (the form that takes an argument) was added in
> r219577.  Before then, only the plain form existed.  If I had
> to guess, the interplay between the two options (as opposed to
> making the latter an alias for the new option) wasn't considered.
> I didn't think of it until now either.  Your patch seems like
> the right solution to me.  Let me know if you will submit it.
> If not, I posted the patch below that touches this area and
> that will likely need updating so I can roll your change into
> it:
> 
> https://gcc.gnu.org/ml/gcc-patches/2018-07/msg01286.html

I'll post a patch tomorrow, since I already have all the changes 
available and tested here.

Note that one minor change with this patch is that with 
-fdiagnostics-show-option the message will show -Warray-bounds= (equal 
sign added) instead of -Warray-bounds.

Franz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: committed: remove redundant -Wall from -Warray-bounds (PR 82063)
  2018-07-24 19:48     ` Franz Sirl
@ 2018-07-24 20:18       ` Martin Sebor
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Sebor @ 2018-07-24 20:18 UTC (permalink / raw)
  To: Franz Sirl, Gcc Patch List

On 07/24/2018 01:48 PM, Franz Sirl wrote:
> Am 2018-07-24 um 17:35 schrieb Martin Sebor:
>> On 07/24/2018 03:24 AM, Franz Sirl wrote:
>>> Am 2018-07-20 um 23:22 schrieb Martin Sebor:
>>>> As the last observation in PR 82063 Jim points out that
>>>>
>>>>    Both -Warray-bounds and -Warray-bounds= are listed in the c.opt
>>>>    file as being enabled by -Wall, but they are the same option,
>>>>    and it causes this one option to be processed twice in the
>>>>    C_handle_option_auto function in the generated options.c file.
>>>>    It gets set to the same value twice, so it does work as intended,
>>>>    but this is wasteful.
>>>>
>>>> I have removed the redundant -Wall from the first option and
>>>> committed the change as obvious in r262912.
>>>
>>> Hi Martin,
>>>
>>> this looks related to PR 68845 and my patch in there. I never posted it
>>> to gcc-patches because I couldn't find a definitive answer on how
>>> options duplicated between common.opt and c-family/c.opt are supposed to
>>> be handled.
>>> For example, Warray-bounds in common.opt is a separate option (not an
>>> alias to Warray-bounds=), leading to separate enums for them. Is this
>>> intended? Warray-bounds seemed to be the only option with an equal sign
>>> doing it like that at that time. Now Wcast-align is doing the same...
>>>
>>> Can you shed some light on this?
>>
>> -Warray-bounds= (the form that takes an argument) was added in
>> r219577.  Before then, only the plain form existed.  If I had
>> to guess, the interplay between the two options (as opposed to
>> making the latter an alias for the new option) wasn't considered.
>> I didn't think of it until now either.  Your patch seems like
>> the right solution to me.  Let me know if you will submit it.
>> If not, I posted the patch below that touches this area and
>> that will likely need updating so I can roll your change into
>> it:
>>
>> https://gcc.gnu.org/ml/gcc-patches/2018-07/msg01286.html
>
> I'll post a patch tomorrow, since I already have all the changes
> available and tested here.
>
> Note that one minor change with this patch is that with
> -fdiagnostics-show-option the message will show -Warray-bounds= (equal
> sign added) instead of -Warray-bounds.

That should be fine.

Martin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* options: Remove 'gcc/c-family/c.opt:Warray-bounds' option definition record (was: committed: remove redundant -Wall from -Warray-bounds (PR 82063))
  2018-07-20 21:22 committed: remove redundant -Wall from -Warray-bounds (PR 82063) Martin Sebor
  2018-07-24  9:24 ` Franz Sirl
@ 2022-03-29  9:23 ` Thomas Schwinge
  2022-03-29 18:00   ` Joseph Myers
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Schwinge @ 2022-03-29  9:23 UTC (permalink / raw)
  To: Martin Sebor, gcc-patches, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Hi!

On 2018-07-20T15:22:23-0600, Martin Sebor <msebor@gmail.com> wrote:
> As the last observation in PR 82063 Jim points out that
>
>    Both -Warray-bounds and -Warray-bounds= are listed in the c.opt
>    file as being enabled by -Wall, but they are the same option,
>    and it causes this one option to be processed twice in the
>    C_handle_option_auto function in the generated options.c file.
>    It gets set to the same value twice, so it does work as intended,
>    but this is wasteful.
>
> I have removed the redundant -Wall from the first option and
> committed the change as obvious in r262912.

That's r262912/commit 0d7f90652080c42cddca6f9b68f6895218c70880
"PR middle-end/82063 - issues with arguments enabled by -Wall":

| --- gcc/c-family/c.opt
| +++ gcc/c-family/c.opt
| [...]
|  Warray-bounds
| -LangEnabledBy(C ObjC C++ LTO ObjC++,Wall)
| +LangEnabledBy(C ObjC C++ LTO ObjC++)
|  ; in common.opt
|
|  Warray-bounds=

OK to push the attached "options: Remove
'gcc/c-family/c.opt:Warray-bounds' option definition record"?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-options-Remove-gcc-c-family-c.opt-Warray-bounds-opti.patch --]
[-- Type: text/x-diff, Size: 1436 bytes --]

From 15b8d3d6265529bcab74c81b742cd4d1ef2ef37b Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 24 Mar 2022 22:17:23 +0100
Subject: [PATCH] options: Remove 'gcc/c-family/c.opt:Warray-bounds' option
 definition record

A one-argument form of the 'LangEnabledBy' option property isn't defined,
and effectively appears to be a no-op.  Removing that one, the
'gcc/c-family/c.opt:Warray-bounds' option definition record becomes empty,
and doesn't add anything over 'gcc/common.opt:Warray-bounds', and may thus
be removed entirely.  This only changes 'build-gcc/gcc/optionlist'
accordingly, but no other generated files.

Clean-up after r262912/commit 0d7f90652080c42cddca6f9b68f6895218c70880
"PR middle-end/82063 - issues with arguments enabled by -Wall".

	gcc/c-family/
	* c.opt (Warray-bounds): Remove.
---
 gcc/c-family/c.opt | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 790d47caf0a..3c2ec7744b0 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -342,10 +342,6 @@ Wno-alloca-larger-than
 C ObjC C++ LTO ObjC++ Alias(Walloca-larger-than=,18446744073709551615EiB,none) Warning
 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
-
 Warray-bounds=
 LangEnabledBy(C ObjC C++ LTO ObjC++,Wall,1,0)
 ; in common.opt
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: options: Remove 'gcc/c-family/c.opt:Warray-bounds' option definition record (was: committed: remove redundant -Wall from -Warray-bounds (PR 82063))
  2022-03-29  9:23 ` options: Remove 'gcc/c-family/c.opt:Warray-bounds' option definition record (was: committed: remove redundant -Wall from -Warray-bounds (PR 82063)) Thomas Schwinge
@ 2022-03-29 18:00   ` Joseph Myers
  0 siblings, 0 replies; 7+ messages in thread
From: Joseph Myers @ 2022-03-29 18:00 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: Martin Sebor, gcc-patches

On Tue, 29 Mar 2022, Thomas Schwinge wrote:

> | --- gcc/c-family/c.opt
> | +++ gcc/c-family/c.opt
> | [...]
> |  Warray-bounds
> | -LangEnabledBy(C ObjC C++ LTO ObjC++,Wall)
> | +LangEnabledBy(C ObjC C++ LTO ObjC++)
> |  ; in common.opt
> |
> |  Warray-bounds=
> 
> OK to push the attached "options: Remove
> 'gcc/c-family/c.opt:Warray-bounds' option definition record"?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-29 18:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 21:22 committed: remove redundant -Wall from -Warray-bounds (PR 82063) Martin Sebor
2018-07-24  9:24 ` Franz Sirl
2018-07-24 15:36   ` Martin Sebor
2018-07-24 19:48     ` Franz Sirl
2018-07-24 20:18       ` Martin Sebor
2022-03-29  9:23 ` options: Remove 'gcc/c-family/c.opt:Warray-bounds' option definition record (was: committed: remove redundant -Wall from -Warray-bounds (PR 82063)) Thomas Schwinge
2022-03-29 18:00   ` Joseph Myers

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).