> From: dwhee...@dwheeler.com
> To: dale.vis...@gmail.com
> CC: autoconf-patches@gnu.org
> Subject: Re: Turn on compiler warnings by default for AC_PROG_CC, AC_PROG_CXX 
> & AC_PROG_FC
> Date: Fri, 7 Feb 2014 10:20:50 -0500
> 
> The AC_APPEND_FLAG doesn't provide the functionality I would want for 
> portability,
> because it doesn't really check if the flag works (and it doesn't report the 
> checking either).
> For example, if I add this:
> AC_APPEND_FLAG([-Wno-such-option], [CFLAGS])
> the "-Wno-such-option" is still passed to the compiler. Ugh.
> 
> Perhaps you could change its functionality, or create a separate macro with 
> that functionality.
> That way, you could enable/disable warnings on compilers that accepted the 
> flag... and
> still work on compilers that didn't support it.
> 
> Anyway, I think you're on the right path, just need some tweaks before it's 
> ready.

David:

Your point is well-taken. Please find attached a revision of the earlier patch. 
This one includes AC_APPEND_*FLAG_IFVALID macros (* = C, CXX or FC) that will 
append flags to the compiler invocation only if a test compilation with those 
flags exits normally. In addition, I've made clarifications in the 
documentation about how to not add the newly default warning flags if desired, 
and I've standardized the informative printed output generated by the macros 
when configure is run.

I think this change to the default behavior of AC_PROG_* (* =  CC, CXX or FC) 
will help many projects using autoconf to become aware of issues in their code, 
ultimately helping to make it more reliable and secure. And as noted in the 
documentation changes, it is straightforward to restore the old, 
non-flag-adding behavior, as well as to add compiler flags you find useful for 
your particular code base.

Best regards,
Dale
                                          

Attachment: merged_patch.diff
Description: Binary data

Reply via email to