public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Disallow -gno-dwarf, gno-dwarf-N, -gno-gdb and -gno-vms
@ 2023-03-24 10:19 Richard Biener
  2023-03-27 22:18 ` Joseph Myers
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2023-03-24 10:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: Joseph S. Myers, Jakub Jelinek

The following adds RejectNegative to the gdwarf, gdwarf-, ggdb and gvms
options since the current behavior is to treat the negative variant
the same as the positive variant.  In particular -ggdb -gno-gdb
do not cancel, and plain -gno-dwarf will enable (dwarf!) debug output.

Rejecting the negative forms avoids interpreting sensible behavior
to combinations of options like -gdwarf-5 -gno-dwarf-3 and sticks to
the behavior that later -g options simply override earlier ones and
the only negative form is -g0.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

Thanks,
Richard.

	* common.opt (gdwarf): Add RejectNegative.
	(gdwarf-): Likewise.
	(ggdb): Likewise.
	(gvms): Likewise.
---
 gcc/common.opt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index e558385c7f4..4546acb5b81 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3349,11 +3349,11 @@ Common Driver RejectNegative JoinedOrMissing
 Generate BTF debug information at default level.
 
 gdwarf
-Common Driver JoinedOrMissing Negative(gdwarf-)
+Common Driver JoinedOrMissing Negative(gdwarf-) RejectNegative
 Generate debug information in default version of DWARF format.
 
 gdwarf-
-Common Driver Joined UInteger Var(dwarf_version) Init(DWARF_VERSION_DEFAULT)
+Common Driver Joined UInteger Var(dwarf_version) Init(DWARF_VERSION_DEFAULT) RejectNegative
 Generate debug information in DWARF v2 (or later) format.
 
 gdwarf32
@@ -3365,7 +3365,7 @@ Common Driver Var(dwarf_offset_size,8) RejectNegative
 Use 64-bit DWARF format when emitting DWARF debug information.
 
 ggdb
-Common Driver JoinedOrMissing
+Common Driver JoinedOrMissing RejectNegative
 Generate debug information in default extended format.
 
 ginline-points
@@ -3432,7 +3432,7 @@ gvariable-location-views=incompat5
 Common Driver RejectNegative Var(debug_variable_location_views, -1) Init(2)
 
 gvms
-Common Driver JoinedOrMissing
+Common Driver JoinedOrMissing RejectNegative
 Generate debug information in VMS format.
 
 gxcoff
-- 
2.35.3


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

* Re: [PATCH 1/2] Disallow -gno-dwarf, gno-dwarf-N, -gno-gdb and -gno-vms
  2023-03-24 10:19 [PATCH 1/2] Disallow -gno-dwarf, gno-dwarf-N, -gno-gdb and -gno-vms Richard Biener
@ 2023-03-27 22:18 ` Joseph Myers
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Myers @ 2023-03-27 22:18 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, Jakub Jelinek

On Fri, 24 Mar 2023, Richard Biener via Gcc-patches wrote:

> The following adds RejectNegative to the gdwarf, gdwarf-, ggdb and gvms
> options since the current behavior is to treat the negative variant
> the same as the positive variant.  In particular -ggdb -gno-gdb
> do not cancel, and plain -gno-dwarf will enable (dwarf!) debug output.
> 
> Rejecting the negative forms avoids interpreting sensible behavior
> to combinations of options like -gdwarf-5 -gno-dwarf-3 and sticks to
> the behavior that later -g options simply override earlier ones and
> the only negative form is -g0.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

end of thread, other threads:[~2023-03-27 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 10:19 [PATCH 1/2] Disallow -gno-dwarf, gno-dwarf-N, -gno-gdb and -gno-vms Richard Biener
2023-03-27 22:18 ` 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).