[ovs-dev] [sFlow 2/7] Move C compiler warning (-W) flags from CFLAGS to AM_CFLAGS.

Ben Pfaff blp at nicira.com
Mon Nov 23 20:22:50 UTC 2009


Thanks, I'll push this soon.

Justin Pettit <jpettit at nicira.com> writes:

> Looks good.
>
> --Justin
>
>
> On Nov 19, 2009, at 1:48 PM, Ben Pfaff wrote:
>
>> C compiler warning options added by the "configure" script have until
>> now been put into CFLAGS.  However that option is supposed to be reserved
>> for the user under Automake rules, so move them to AM_CFLAGS.
>> 
>> Besides increased adherence to Automake rules, this is useful because
>> AM_CFLAGS can be overridden on a per-target (e.g. program or library)
>> basis, whereas CFLAGS cannot.  In turn, building the sFlow library (which
>> will be added in an upcoming commit) requires overriding the compiler
>> flags to avoid some warning messages.  (By modifying the warning flags, we
>> avoid the need to modify the sFlow library in any way.)
>> ---
>> Makefile.am  |    1 +
>> acinclude.m4 |    5 +++--
>> 2 files changed, 4 insertions(+), 2 deletions(-)
>> 
>> diff --git a/Makefile.am b/Makefile.am
>> index add0e72..de51e10 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -16,6 +16,7 @@ AM_CPPFLAGS += -I $(top_srcdir)/include
>> AM_CPPFLAGS += -I $(top_srcdir)/lib
>> 
>> AM_CFLAGS = -Wstrict-prototypes
>> +AM_CFLAGS += $(WARNING_FLAGS)
>> 
>> if NDEBUG
>> AM_CPPFLAGS += -DNDEBUG
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index 767414e..e37a316 100644
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -230,8 +230,9 @@ AC_DEFUN([OVS_CHECK_CC_OPTION],
>> 
>> dnl OVS_ENABLE_OPTION([OPTION])
>> dnl Check whether the given C compiler OPTION is accepted.
>> -dnl If so, add it to CFLAGS.
>> +dnl If so, add it to WARNING_FLAGS.
>> dnl Example: OVS_ENABLE_OPTION([-Wdeclaration-after-statement])
>> AC_DEFUN([OVS_ENABLE_OPTION], 
>> -  [OVS_CHECK_CC_OPTION([$1], [CFLAGS="$CFLAGS $1"])])
>> +  [OVS_CHECK_CC_OPTION([$1], [WARNING_FLAGS="$WARNING_FLAGS $1"])
>> +   AC_SUBST([WARNING_FLAGS])])
>> dnl ----------------------------------------------------------------------
>> -- 
>> 1.6.3.3
>> 
>> 
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org




More information about the dev mailing list