On Wed, May 27, 2026 at 5:51 AM Daniel Barboza
<[email protected]> wrote:
>
> The option is now obsolete.  Remove the remaining enum and update
> common.opt to make it official.
>
> gcc/ChangeLog:
>
>         * common.opt:  Updated Wstrict-overflow entry to indicate that
>         it does nothing now.
>         * coretypes.h (enum warn_strict_overflow_code): Enum removed.
>         * opts.cc (common_handle_option): Removed OPT_Wstrict_overflow
>         logic.

As mentioned you need to update doc/invoke.texi too.

> ---
>  gcc/common.opt  |  2 +-
>  gcc/coretypes.h | 24 ------------------------
>  gcc/opts.cc     |  4 +---
>  3 files changed, 2 insertions(+), 28 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 3ad1444cc88..9797118d187 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -782,7 +782,7 @@ Warn about code which might break strict aliasing rules.
>
>  Wstrict-overflow
>  Common Warning
You should add Ignore to the above.

> -Warn about optimizations that assume that signed overflow is undefined.
> +Does nothing.  Preserved for backward compatibility.
>
>  Wstrict-overflow=
>  Common Joined RejectNegative UInteger Var(warn_strict_overflow) Warning
> diff --git a/gcc/coretypes.h b/gcc/coretypes.h
> index 465bead6863..c42c053eb33 100644
> --- a/gcc/coretypes.h
> +++ b/gcc/coretypes.h
> @@ -320,30 +320,6 @@ enum var_init_status
>    VAR_INIT_STATUS_INITIALIZED
>  };
>
> -/* Names for the different levels of -Wstrict-overflow=N.  The numeric
> -   values here correspond to N.  */
> -enum warn_strict_overflow_code
> -{
> -  /* Overflow warning that should be issued with -Wall: a questionable
> -     construct that is easy to avoid even when using macros.  Example:
> -     folding (x + CONSTANT > x) to 1.  */
> -  WARN_STRICT_OVERFLOW_ALL = 1,
> -  /* Overflow warning about folding a comparison to a constant because
> -     of undefined signed overflow, other than cases covered by
> -     WARN_STRICT_OVERFLOW_ALL.  Example: folding (abs (x) >= 0) to 1
> -     (this is false when x == INT_MIN).  */
> -  WARN_STRICT_OVERFLOW_CONDITIONAL = 2,
> -  /* Overflow warning about changes to comparisons other than folding
> -     them to a constant.  Example: folding (x + 1 > 1) to (x > 0).  */
> -  WARN_STRICT_OVERFLOW_COMPARISON = 3,
> -  /* Overflow warnings not covered by the above cases.  Example:
> -     folding ((x * 10) / 5) to (x * 2).  */
> -  WARN_STRICT_OVERFLOW_MISC = 4,
> -  /* Overflow warnings about reducing magnitude of constants in
> -     comparison.  Example: folding (x + 2 > y) to (x + 1 >= y).  */
> -  WARN_STRICT_OVERFLOW_MAGNITUDE = 5
> -};
> -
>  /* Kind of artificial, compiler-generated lookup table.  Type of the
>     second argument of TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA resp.
>     targetm.addr_space.for_artificial_rodata.  */
> diff --git a/gcc/opts.cc b/gcc/opts.cc
> index 09baa411cfd..17c54b6688e 100644
> --- a/gcc/opts.cc
> +++ b/gcc/opts.cc
> @@ -2952,9 +2952,7 @@ common_handle_option (struct gcc_options *opts,
>        break;
>
>      case OPT_Wstrict_overflow:
> -      opts->x_warn_strict_overflow = (value
> -                                     ? (int) WARN_STRICT_OVERFLOW_CONDITIONAL
> -                                     : 0);
> +      /* Deferred.  */
>        break;

Remove this fully rather than keeping the reference to OPT_Wstrict_overflow.

>
>      case OPT_Wsystem_headers:
> --
> 2.43.0
>

Reply via email to