https://gcc.gnu.org/g:5b276d38c2fdd7df3d167755940da2038e049308
commit r16-5128-g5b276d38c2fdd7df3d167755940da2038e049308 Author: Sandra Loosemore <[email protected]> Date: Fri Oct 17 15:11:47 2025 +0000 Add "RejectNegative" to some options where it doesn't make sense [PR122243] This patch adds the "RejectNegative" property to several options where it doesn't make sense. These are either options of the form "name=value" rather than an on/off switch, those that are already in a "no-" form, or options that form a mutually-exclusive set. Also, the fhelp, ftarget-help, and fversion options that do not take arguments ignore the "-no" prefix so that even "-fno-help" (etc) causes help to be printed instead of suppressing help output. Since that behavior is not useful, I've added RejectNegative to those options as well. gcc/analyzer/ChangeLog PR other/122243 * analyzer.opt (fanalyzer-verbosity=): Add RejectNegative. gcc/c-family/ChangeLog PR other/122243 * c.opt: (fdeps-format=): Add RejectNegative. (fdeps-file=): Likewise. (fdeps-target=): Likewise. (Walloc-size-larger-than=): Likewise. (Wno-alloc-size-larger-than): Likewise. (Walloca-larger-than=): Likewise. (Wno-alloca-larger-than): Likewise. (Woverloaded-virtual=): Likewise. (Wvla-larger-than=): Likewise. (Wno-vla-larger-than): Likewise. (fopenacc-dim=): Likewise. (femit-struct-debug-baseonly): Likewise. (femit-struct-debug-reduced): Likewise. (femit-struct-debug-detailed=): Likewise. gcc/ChangeLog PR other/122243 * common.opt (fhelp): Add RejectNegative. (fhelp=): Likewise. (ftarget-help): Likewise. (fversion): Likewise. (Wno-frame-larger-than): Likewise. (Wno-larger-than): Likewise. (Wno-stack-usage): Likewise. (fdiagnostics-minimum-margin-width=): Likewise. (flto-incremental=): Likewise. (foffload=): Likewise. (foffload-options=): Likewise. (foffload-abi-host-opts=): Likewise. (fpatchable-function-entry=): Likewise. (gno-pubnames): Likewise. (gpubnames): Likewise. (ggnu-pubnames): Likewise. Diff: --- gcc/analyzer/analyzer.opt | 2 +- gcc/c-family/c.opt | 28 ++++++++++++++-------------- gcc/common.opt | 32 ++++++++++++++++---------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/gcc/analyzer/analyzer.opt b/gcc/analyzer/analyzer.opt index 2ca905854bda..611b987daecc 100644 --- a/gcc/analyzer/analyzer.opt +++ b/gcc/analyzer/analyzer.opt @@ -335,7 +335,7 @@ Common Var(flag_analyzer_verbose_state_changes) Init(0) Emit more verbose descriptions of state changes in diagnostics. fanalyzer-verbosity= -Common Joined UInteger Var(analyzer_verbosity) Init(2) +Common RejectNegative Joined UInteger Var(analyzer_verbosity) Init(2) Control which events are displayed in diagnostic paths. fdump-analyzer diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 66099c7f397a..b8bdc2be6d52 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -267,15 +267,15 @@ C ObjC C++ ObjC++ Joined Separate MissingArgError(missing makefile target after -MT <target> Add a target that does not require quoting. fdeps-format= -C ObjC C++ ObjC++ NoDriverArg Joined MissingArgError(missing format after %qs) +C ObjC C++ ObjC++ RejectNegative Joined MissingArgError(missing format after %qs) Structured format for output dependency information. Supported (\"p1689r5\"). fdeps-file= -C ObjC C++ ObjC++ NoDriverArg Joined MissingArgError(missing output path after %qs) +C ObjC C++ ObjC++ RejectNegative Joined MissingArgError(missing output path after %qs) File for output dependency information. fdeps-target= -C ObjC C++ ObjC++ NoDriverArg Joined MissingArgError(missing path after %qs) +C ObjC C++ ObjC++ RejectNegative Joined MissingArgError(missing path after %qs) -fdeps-target=obj.o Output file for the compile step. P @@ -351,12 +351,12 @@ C ObjC C++ ObjC++ Var(warn_alloc_size) Warning LangEnabledBy(C ObjC C++ ObjC++, Warn when allocating insufficient storage for the target type of the assigned pointer. 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) +C ObjC C++ LTO ObjC++ Var(warn_alloc_size_limit) Joined RejectNegative Host_Wide_Int ByteSize Warning Init(HOST_WIDE_INT_MAX) -Walloc-size-larger-than=<bytes> Warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes. Wno-alloc-size-larger-than -C ObjC C++ LTO ObjC++ Alias(Walloc-size-larger-than=,18446744073709551615EiB,none) Warning +C ObjC C++ LTO ObjC++ RejectNegative Alias(Walloc-size-larger-than=,18446744073709551615EiB,none) Warning Disable Walloc-size-larger-than= warning. Equivalent to Walloc-size-larger-than=<SIZE_MAX> or larger. Walloc-zero @@ -364,13 +364,13 @@ C ObjC C++ ObjC++ Var(warn_alloc_zero) Warning 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) +C ObjC C++ LTO ObjC++ Var(warn_alloca_limit) Warning Joined RejectNegative 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 +C ObjC C++ LTO ObjC++ RejectNegative Alias(Walloca-larger-than=,18446744073709551615EiB,none) Warning Disable Walloca-larger-than= warning. Equivalent to Walloca-larger-than=<SIZE_MAX> or larger. Warith-conversion @@ -1211,7 +1211,7 @@ C++ ObjC++ Warning Alias(Woverloaded-virtual=,2,0) Warn about overloaded virtual function names. Woverloaded-virtual= -C++ ObjC++ Joined UInteger IntegerRange(0,2) Var(warn_overloaded_virtual) Warning LangEnabledBy(C++ ObjC++,Wall,1,0) +C++ ObjC++ Joined RejectNegative UInteger IntegerRange(0,2) Var(warn_overloaded_virtual) Warning LangEnabledBy(C++ ObjC++,Wall,1,0) Warn about overloaded virtual function names. Woverride-init @@ -1651,13 +1651,13 @@ C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning Warn if a variable length array is used. Wvla-larger-than= -C ObjC C++ LTO ObjC++ Var(warn_vla_limit) Warning Joined Host_Wide_Int ByteSize Init(HOST_WIDE_INT_MAX) +C ObjC C++ LTO ObjC++ Var(warn_vla_limit) Warning Joined RejectNegative Host_Wide_Int ByteSize Init(HOST_WIDE_INT_MAX) -Wvla-larger-than=<number> Warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes. Wno-vla-larger-than -C ObjC C++ LTO ObjC++ Alias(Wvla-larger-than=,18446744073709551615EiB,none) Warning +C ObjC C++ LTO ObjC++ RejectNegative Alias(Wvla-larger-than=,18446744073709551615EiB,none) Warning Disable Wvla-larger-than= warning. Equivalent to Wvla-larger-than=<SIZE_MAX> or larger. Wvla-parameter @@ -2263,7 +2263,7 @@ C ObjC C++ ObjC++ LTO Var(flag_openacc) Enable OpenACC. fopenacc-dim= -C ObjC C++ ObjC++ LTO Joined Var(flag_openacc_dims) +C ObjC C++ ObjC++ LTO Joined RejectNegative Var(flag_openacc_dims) Specify default OpenACC compute dimensions. fopenmp @@ -2494,15 +2494,15 @@ ObjC ObjC++ Driver Var(flag_gen_declaration) RejectNegative Dump declarations to a .decl file. femit-struct-debug-baseonly -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ RejectNegative -femit-struct-debug-baseonly Aggressive reduced debug info for structs. femit-struct-debug-reduced -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ RejectNegative -femit-struct-debug-reduced Conservative reduced debug info for structs. femit-struct-debug-detailed= -C ObjC C++ ObjC++ Joined +C ObjC C++ ObjC++ Joined RejectNegative -femit-struct-debug-detailed=<spec-list> Detailed reduced debug info for structs. fext-numeric-literals diff --git a/gcc/common.opt b/gcc/common.opt index 2ccfb44eac0b..2c8c0e447502 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -426,16 +426,16 @@ Driver Alias(v) ;; as -fhelp; the following four entries are for compatibility with ;; any direct uses of those (undocumented) -f forms fhelp -Common Driver Alias(-help) +Common Driver RejectNegative Alias(-help) fhelp= -Common Driver Joined Alias(-help=) +Common Driver RejectNegative Joined Alias(-help=) ftarget-help -Common Driver Alias(-target-help) +Common Driver RejectNegative Alias(-target-help) fversion -Common Driver Alias(-version) +Common Driver RejectNegative Alias(-version) -sysroot Driver Separate Alias(-sysroot=) @@ -628,7 +628,7 @@ Common RejectNegative Joined Host_Wide_Int ByteSize Warning Var(warn_frame_large -Wframe-larger-than=<byte-size> Warn if a function's stack frame requires in excess of <byte-size>. Wno-frame-larger-than -Common Alias(Wframe-larger-than=,18446744073709551615EiB,none) Warning +Common RejectNegative Alias(Wframe-larger-than=,18446744073709551615EiB,none) Warning Disable -Wframe-larger-than= warning. Equivalent to -Wframe-larger-than=<SIZE_MAX> or larger. Wfree-nonheap-object @@ -670,7 +670,7 @@ Common RejectNegative Joined Host_Wide_Int ByteSize Warning Var(warn_larger_than -Wlarger-than=<byte-size> Warn if an object's size exceeds <byte-size>. Wno-larger-than -Common Alias(Wlarger-than=,18446744073709551615EiB,none) Warning +Common RejectNegative Alias(Wlarger-than=,18446744073709551615EiB,none) Warning Disable -Wlarger-than= warning. Equivalent to -Wlarger-than=<SIZE_MAX> or larger. Wnonnull-compare @@ -755,7 +755,7 @@ Common Joined RejectNegative Host_Wide_Int ByteSize Var(warn_stack_usage) Warnin -Wstack-usage=<byte-size> Warn if stack usage might exceed <byte-size>. Wno-stack-usage -Common Alias(Wstack-usage=,18446744073709551615EiB,none) Warning +Common RejectNegative Alias(Wstack-usage=,18446744073709551615EiB,none) Warning Disable Wstack-usage= warning. Equivalent to Wstack-usage=<SIZE_MAX> or larger. Wstrict-aliasing @@ -1618,7 +1618,7 @@ EnumValue Enum(diagnostic_text_art_charset) String(emoji) Value(DIAGNOSTICS_TEXT_ART_CHARSET_EMOJI) fdiagnostics-minimum-margin-width= -Common Joined UInteger Var(diagnostics_minimum_margin_width) Init(6) +Common Joined RejectNegative UInteger Var(diagnostics_minimum_margin_width) Init(6) Set minimum width of left margin of source code when showing source. fdiagnostics-show-nesting @@ -2311,7 +2311,7 @@ Common RejectNegative Joined Var(flag_lto) Link-time optimization with number of parallel jobs or jobserver. flto-incremental= -Common Joined Var(flag_lto_incremental) +Common Joined RejectNegative Var(flag_lto_incremental) Enable incremental LTO, with its cache in given directory. flto-incremental-cache-size= @@ -2443,10 +2443,10 @@ Common Var(flag_non_call_exceptions) Optimization Support synchronous non-call exceptions. foffload= -Driver Joined MissingArgError(targets missing after %qs) +Driver Joined RejectNegative MissingArgError(targets missing after %qs) foffload-options= -Common Driver Joined MissingArgError(options or targets=options missing after %qs) +Common Driver Joined RejectNegative MissingArgError(options or targets=options missing after %qs) -foffload-options=<targets>=<options> Specify options for the offloading targets. foffload-abi= @@ -2463,7 +2463,7 @@ EnumValue Enum(offload_abi) String(lp64) Value(OFFLOAD_ABI_LP64) foffload-abi-host-opts= -Common Joined MissingArgError(option missing after %qs) +Common Joined RejectNegative MissingArgError(option missing after %qs) -foffload-abi-host-opts=<options> Specify host ABI options. fomit-frame-pointer @@ -2716,7 +2716,7 @@ Common Var(flag_profile_reorder_functions) Optimization Enable function reordering that improves code placement. fpatchable-function-entry= -Common Var(flag_patchable_function_entry) Joined Optimization +Common Var(flag_patchable_function_entry) Joined RejectNegative Optimization Insert NOP instructions at each function entry. frandom-seed @@ -3723,15 +3723,15 @@ RejectNegative Joined Undocumented ; Catch the gno- prefix, so it doesn't backtrack to g<level>. gno-pubnames -Common Driver Negative(gpubnames) Var(debug_generate_pub_sections, 0) Init(-1) +Common Driver RejectNegative Negative(gpubnames) Var(debug_generate_pub_sections, 0) Init(-1) Don't generate DWARF pubnames and pubtypes sections. gpubnames -Common Driver Negative(ggnu-pubnames) Var(debug_generate_pub_sections, 1) +Common Driver RejectNegative Negative(ggnu-pubnames) Var(debug_generate_pub_sections, 1) Generate DWARF pubnames and pubtypes sections. ggnu-pubnames -Common Driver Negative(gno-pubnames) Var(debug_generate_pub_sections, 2) +Common Driver RejectNegative Negative(gno-pubnames) Var(debug_generate_pub_sections, 2) Generate DWARF pubnames and pubtypes sections with GNU extensions. grecord-gcc-switches
