On 8/4/18, Peter Johansson <trojkan@xxxxxxxxx> wrote: > On 8/3/2018 9:38 AM, Jeffrey Walton wrote: >> If I change to CXXFLAGS="-Werror" then MSC and other Windows compilers >> incorrectly reject the program. >> >> I think the root cause of the problem is, I need a cross-platform way >> to say "treat warnings as error". But I don't see an >> AC_WARNINGS_AS_ERRORS or similar in Autoconf. > > There is an AC_LANG_WERROR, but not sure how cross-platform it is. > Hopefully it parses stderror rather relying on compiler switches such as > -Werror. IIRC, it worked for me when I used it, but I think one problem > was that there was no way to turn off this "warnings are errors"-behaviour. It appears to work simply by checking whether or not the compiler produced any output whatsoever on standard error. There appears to be no documented way to turn it off after you turn it on. This is probably an oversight, because several of Autoconf's own tests do exactly that with a pattern like: save_ac_FOO_werror_flag=$ac_FOO_werror_flag ac_FOO_werror_flag=yes [perform tests here] ac_FOO_werror_flag=$save_ac_FOO_werror_flag where FOO is the language name; e.g. "cxx" for C++. Being able to save and restore the state in a similar manner would probably more useful than the one-way switch we have today. Anyway, if ac_cxx_werror_flag is set to any nonempty string then the standard error check is enabled for C++ compiles, but this isn't documented behaviour so up to you whether you want to make use of that or not. You could also submit a patch which gives a documented way to do this :) Cheers, Nick _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf