]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix --disable-strict-error-checking and -W... options handling (#1091)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 22 Jul 2022 17:36:44 +0000 (17:36 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 22 Jul 2022 18:17:04 +0000 (18:17 +0000)
commit0ba77a3c30047a93219d766ce5c436e39bc94dbf
treeb97e9c254eb524c0baa840417581f74039571854
parentd146da3bfe7083381ae7ab38640cbfd0d2542374
Fix --disable-strict-error-checking and -W... options handling (#1091)

Commit 8b082ed (Activate extra compiler checks):

* started adding -Werror in --disable-strict-error-checking builds
* stopped adding -Wall to CXXFLAGS
* forgot that -Werror is spelled $squid_cv_cc_option_werror
* forgot that "=" is converted to "_" in $squid_cv_cc_arg... name
* forgot that "W" is present in $squid_cv_cc_arg... name
* checked squid_cv_cc_... name but set squid_cv_cc_arg... name
* used warning-generating SQUID_CC_CHECK_ARGUMENT code for testing
  compiler support for new -W options (while also using -Werror)

Correctly detecting support for a compiler warning option is difficult:

* Some compilers (e.g., clang) exit successfully when given an
  unsupported command line option unless we also give -Werror. With
  those compilers, we must use "-Werror -Wx" to test for -Wx support.
  However, that does not mean we should add -Werror to all Squid builds.

* Adding -Werror does not work for detecting supported GCC warnings: GCC
  needs -Werror=no-x to fail on unsupported -Wno-x warnings.

* We do not even know how to detect (via compiler exit code) supported
  warnings for compilers other than clang and GCC. We still add -Werror
  to all compilers other than GCC when testing -X, but, based on quick
  godbolt.org tests, -Werror does not make icc fail on unsupported -Wx.

Also delayed adding warnings until we are done adding such C++ compiler
options as -std=c++11 (and, for Irix, optimization level) because those
options may affect the set of warnings supported by the compiler. We
also (now) need SQUID_CC_GUESS_VARIANT and SQUID_CC_GUESS_OPTIONS. We
might need AC_PROG_CPP. All those things are settled after the official
code attempted to add warnings. The best code location probably needs
more work, but at least all warnings are handled in the same code now.

These changes also fix Bug 5167 (GCC -Wno-unused-private-field
miscategorized as supported).

Also fixed clang (-Wall => -Wmost) warnings exposed by the above fixes.
acinclude/compiler-flags.m4
configure.ac
src/HttpHeader.cc
src/client_side_request.cc
src/http/RegisteredHeaders.h
src/refresh.cc
src/security/Session.cc
src/tests/testRandomUuid.cc