configure.ac: fix -Wno-deprecated-enum-enum-conversion probe under ccache#10897
Open
julek-wolfssl wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts an Autoconf compile-flag probe in configure.ac so that -Wno-deprecated-enum-enum-conversion (a C++/ObjC++-only warning option) is not incorrectly detected as usable for C builds when CC="ccache gcc" reorders -Werror during AX_CHECK_COMPILE_FLAG checks.
Changes:
- Switch the probe from explicitly passing
-Werrorin the flag list to temporarily enablingac_c_werror_flagfor the duration of the check. - Restore the prior
ac_c_werror_flagvalue after the probe to avoid impacting subsequent configure tests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
retest this please. |
|
retest this please |
…ache gcc only promotes "command-line option '-Wno-deprecated-enum-enum-conversion' is valid for C++/ObjC++ but not for C" to an error when -Werror is processed before the -Wno- option. ccache splits the command line into preprocessor and compiler-only options and re-appends -Werror after the -Wno- option, so with CC="ccache gcc" the AX_CHECK_COMPILE_FLAG([-Werror -Wno-...]) probe exits 0. configure then adds the C++-only option to AM_CFLAGS and gcc emits the cc1 warning on every C compilation unit, e.g. in the multi-arch workflow. Gate the probe on ac_c_werror_flag instead: AC_COMPILE_IFELSE then fails on any stderr output, independent of option order. gcc (with or without ccache) now rejects the flag; clang still accepts it silently and keeps it.
5a8dba9 to
b3356b5
Compare
Member
Author
|
retest this please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-Wno-deprecated-enum-enum-conversion(a C++/ObjC++-only option) to an error when-Werroris processed before the-Wno-option. ccache splits the command line into preprocessor and compiler-only options and re-appends-Werrorafter the-Wno-option, so withCC="ccache gcc"theAX_CHECK_COMPILE_FLAGprobe exits 0 and configure adds the C++-only option toAM_CFLAGS, causing gcc to emit the cc1 warning on every C compilation unit (e.g. in the multi-arch workflow).ac_c_werror_flaginstead:AC_COMPILE_IFELSEthen fails on any stderr output, independent of option order. gcc (with or without ccache) now rejects the flag; clang still accepts it silently and keeps it.Test plan
./configure CC="ccache gcc"no longer adds-Wno-deprecated-enum-enum-conversiontoAM_CFLAGS