|
From: Mark W. <mj...@re...> - 2014-07-17 21:48:34
|
Hi, Philippe and I were scratching our heads because we were seeing warnings like: cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default] After a couple of rounds of guesses we concluded the following: On Thu, 2014-07-17 at 21:49 +0200, Philippe Waroquiers wrote: > On Thu, 2014-07-17 at 13:33 +0200, Mark Wielaard wrote: > > > OK, this is really two issues. First this isn't a real gcc option to > > begin with. The warning option is named -Wtype-limits and the > > tautological-compare name is something clang invented. It warns if a > > comparison is always true or always false due to the limited range of > > the data type, but for constant expressions. I am not sure we actually > > would want to disable that warning, it seems pretty useful. > > > > The second issue is that gcc is helpful, it just accepts any -Wno-foobar > > option, assuming it can do that always. "Sure, I won't warn about > > foobar, no problem!" :) The same isn't true the other way around > > -Wfoobar will cause an error if gcc doesn't know how to warn about > > foobar. > > Nice analysis. All this configure/am/... infernal machine is always > a mystery to me. > > > All our -Wno-foobar tests in configure.ac are done the same way. Maybe > > there is a reason for that? But if you only wanted to enable -Wno-foobar > > if the compiler really understood it, then the test in configure.ac > > should be reversed. It should test if the compiler supports -Wfoobar and > > if so, it should use -Wno-foobar to suppress those warnings. > > No idea why the -Wno-foobar are tested like that. > Probably because the gcc "helpfulness" was not known/understood. > > Either as you suggest, we should check for the "positive" switch > or alternatively tests for both the positive and the negative (-Wno...) > switches in configure ? Does anybody see a problem with changing all -Wno-... configure checks around to: --- a/configure.ac +++ b/configure.ac @@ -1728,11 +1728,12 @@ CFLAGS=$safe_CFLAGS # does this compiler support -Wno-tautological-compare ? +# We test for the positive, to make sure the no- variant actually disables. AC_MSG_CHECKING([if gcc accepts -Wno-tautological-compare]) safe_CFLAGS=$CFLAGS -CFLAGS="-Wno-tautological-compare" +CFLAGS="-Wtautological-compare" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ return 0; |
|
From: Julian S. <js...@ac...> - 2014-08-06 11:08:19
|
>>> The second issue is that gcc is helpful, it just accepts any -Wno-foobar >>> option, assuming it can do that always. "Sure, I won't warn about >>> foobar, no problem!" :) The same isn't true the other way around >>> -Wfoobar will cause an error if gcc doesn't know how to warn about >>> foobar. >> >> Nice analysis. Yes, good analysis. I was indeed mystified by the fact that gcc complained about -Wno-tautological-compare despite there being a configure check for it. > Does anybody see a problem with changing all -Wno-... configure checks > around to: That sounds like a good plan to me. J |
|
From: Mark W. <mj...@re...> - 2014-08-20 16:16:58
|
On Wed, 2014-08-06 at 13:08 +0200, Julian Seward wrote: > > Does anybody see a problem with changing all -Wno-... configure checks > > around to: > > That sounds like a good plan to me. I finally did this as valgrind svn r14319. It introduces two convenience functions to set conditionals or do substitutions based on the warning option (they could be a bit more convenient but my autofoo is fairly weak, improvements welcome). Hopefully useful when we decide to test for more warning flags. Please yell and scream if I messed up on some setup. Cheers, Mark |
|
From: Florian K. <fl...@ei...> - 2014-07-18 06:19:02
|
On 17.07.2014 23:48, Mark Wielaard wrote: >> >> Nice analysis. All this configure/am/... infernal machine is always >> a mystery to me. >> >>> All our -Wno-foobar tests in configure.ac are done the same way. Maybe >>> there is a reason for that? Yes. It's called copy and paste. Here's a very nice article that also covers configure and friends. Well worth the read. http://queue.acm.org/detail.cfm?id=2349257 Florian |