diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2017-09-21 02:18:02 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2017-09-21 02:18:02 +0000 |
commit | 9ed32e278609dd7544366ac3639b7ecb5ad4d60f (patch) | |
tree | fa8b7dc93538e14e6db4ef2d2018a93b37b51dca /gcc/c-family | |
parent | d8a61466b974a7ed4a7cafcbb98903bc71f5021d (diff) | |
download | gcc-9ed32e278609dd7544366ac3639b7ecb5ad4d60f.zip gcc-9ed32e278609dd7544366ac3639b7ecb5ad4d60f.tar.gz gcc-9ed32e278609dd7544366ac3639b7ecb5ad4d60f.tar.bz2 |
enable handling of -gno- command-line options as negated prefixes
This patch that adds -g to the set of negatable prefixes along with -f,
-m and -W. Besides the mapping from -gno- to negated -g in option_map
and adding g to the [fmW] matches for negatable options, I had to
introduce gno- as an remapping prefix, for the option searching
machinery to backtrack to and recognize as a remapping prefix, instead
of backtracking to -g and stopping at it as if no-* was its Joined
argument. Adding such remapping prefixes to preempt further
backtracking can be accomplished by introducing the prefix as an
Undocumented option with a Joined argument and without Driver, Target,
Common, or any language-specific option. Whenever we match such a fake
options prefix, we abandon further backtracking (it matches, after all),
but find_opt returns the same code it would if it hadn't found any
match, so that we resort to option mapping.
I've arranged for such remapping prefixes to not be considered when
looking for and suggesting a correct spelling for misspelled options.
While testing that, I found a few -W-started options that were not
marked as RejectNegative but should (-Wno-a, is not something we'd like
to suggest ;-) I've also marked as such -g-started options that
it makes no sense to negate, and removed the explicit -gno- ones,
allowing their opposites to be negated.
for gcc/ChangeLog
* common.opt (Wa, Wl, Wp, g, gz=): Add
RejectNegative.
(gno-column-info): Remove.
(gcolumn-info): Drop RejectNegative.
(gno-): New prefix.
(gno-record-gcc-switches): Remove.
(grecord-gcc-switches): Drop RejectNegative.
(gno-split-dwarf): Remove.
(gsplit-dwarf): Drop RejectNegative.
(gno-strict-dwarf): Remove.
(gstrict-dwarf): Drop RejectNegative.
* config/darwin.opt (gfull, gused): Add RejectNegative.
* dwarf2out.c (gen_producer_string): Drop
gno-record-gcc-switches handler.
* optc-gen.awk: Add g to prefixes with negative forms.
* opts-common.c (remapping_prefix_p): New.
(find_opt): Check it.
(generate_canonical_option): Test g prefix.
(option_map): Add -gno- mapping.
(add_misspelling_candidates): Check remapping_prefix_p.
for gcc/ada/ChangeLog
* gcc-interface/lang.opt (gant, gnatO, gnat): Add
RejectNegative.
for gcc/c-family/ChangeLog
* c.opt (gen-decls): Add RejectNegative.
From-SVN: r253047
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 8003fb5..32f8727 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2017-09-20 Alexandre Oliva <aoliva@redhat.com> + + * c.opt (gen-decls): Add RejectNegative. + 2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com> Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 3c2c107..13d2a59 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1810,7 +1810,7 @@ ObjC ObjC++ Var(flag_zero_link) Generate lazy class lookup (via objc_getClass()) for use in Zero-Link mode. gen-decls -ObjC ObjC++ Driver Var(flag_gen_declaration) +ObjC ObjC++ Driver Var(flag_gen_declaration) RejectNegative Dump declarations to a .decl file. femit-struct-debug-baseonly |