[ovs-dev] [PATCH 3/3] command-line: add ovs_cmdl_context
Russell Bryant
rbryant at redhat.com
Tue Mar 17 15:31:17 UTC 2015
On 03/17/2015 11:11 AM, Ben Pfaff wrote:
> On Tue, Mar 17, 2015 at 10:14:59AM -0400, Russell Bryant wrote:
>> On 03/16/2015 05:16 PM, Russell Bryant wrote:
>>> On 03/16/2015 05:08 PM, Ben Pfaff wrote:
>>>> Would you mind fixing that up?
>>>
>>> No problem at all. Thanks for the feedback! I'll also start testing
>>> builds with both gcc and clang, instead of just gcc. I wonder how I
>>> missed the error ... I'll get it fixed up in any case.
>>
>> To get a clean build of master with clang, I needed to use the following:
>>
>> CFLAGS="-Werror -Qunused-arguments -Wno-unused-value
>> -Wno-tautological-compare"
>>
>> Does that match your dev environment?
>
> Without applying this patch to master,
Same here.
> I don't have to use any special
> flags to get a clean warning-free build. I use:
>
> blp at sigabrt:~/nicira/ovs(0)$ clang --version
> Debian clang version 3.5.0-6 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
> Target: i386-pc-linux-gnu
> Thread model: posix
This is on Fedora 21.
$ clang --version
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
> I don't have DPDK installed if that makes a difference.
Same.
> I configure with --enable-Werror.
That's one difference. The exact commands I use are:
$ ./boot.sh
$ ./configure CC=clang --with-linux=/lib/modules/`uname -r`/build
$ make -j5 EXTRA_CFLAGS="-Wno-error=date-time" CFLAGS="-Werror"
I didn't see special magic with --enable-Werror, but I tried it to be
sure and got the same result with:
$ ./configure CC=clang --with-linux=/lib/modules/`uname -r`/build
--enable-Werror
$ make EXTRA_CFLAGS="-Wno-error=date-time"
> I'd like to get to the bottom of why you're seeing something different;
> my guess is a difference in Clang versions, since Clang pretty regularly
> improves its warnings.
With just -Werror, I get:
libtool: compile: clang -DHAVE_CONFIG_H -I. -I ./include -I ./include
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
-Wpointer-arith -Wformat-security -Wno-format-zero-length -Wswitch-enum
-Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes
-Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers
-Wthread-safety -fno-strict-aliasing -Werror -MT lib/aes128.lo -MD -MP
-MF lib/.deps/aes128.Tpo -c lib/aes128.c -o lib/aes128.o
clang: error: argument unused during compilation: '-I .'
clang: error: argument unused during compilation: '-I ./include'
clang: error: argument unused during compilation: '-I ./include'
clang: error: argument unused during compilation: '-I ./lib'
clang: error: argument unused during compilation: '-I ./lib'
Makefile:3454: recipe for target 'lib/aes128.lo' failed
adding -Qunused-arguments I get to:
libtool: compile: clang -DHAVE_CONFIG_H -I. -I ./include -I ./include
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
-Wpointer-arith -Wformat-security -Wno-format-zero-length -Wswitch-enum
-Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes
-Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers
-Wthread-safety -fno-strict-aliasing -Werror -Qunused-arguments -MT
lib/classifier.lo -MD -MP -MF lib/.deps/classifier.Tpo -c
lib/classifier.c -o lib/classifier.o
In file included from lib/classifier.c:18:
In file included from ./lib/classifier.h:220:
./lib/rculist.h:155:212: error: expression result unused; should this
cast be to 'void'? [-Werror,-Wunused-value]
({ typeof(&elem->next) ovsrcu_var = (&elem->next); typeof(before)
ovsrcu_value = (before); memory_order ovsrcu_order =
(memory_order_relaxed); __c11_atomic_store(&ovsrcu_var->p, ovsrcu_value,
ovsrcu_order); (void *) 0; });
^ ~
(and 19 more instances of the above error)
adding -Wno-unused-value:
libtool: compile: clang -DHAVE_CONFIG_H -I. -I ./include -I ./include
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
-Wpointer-arith -Wformat-security -Wno-format-zero-length -Wswitch-enum
-Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes
-Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers
-Wthread-safety -fno-strict-aliasing -Werror -Qunused-arguments
-Wno-unused-value -MT lib/odp-util.lo -MD -MP -MF lib/.deps/odp-util.Tpo
-c lib/odp-util.c -o lib/odp-util.o
lib/odp-util.c:2700:155: error: self-comparison always evaluates to true
[-Werror,-Wtautological-compare]
} } while (*s++ == ',' && len != 0); if (s[-1] != ')') { return -22;
}; if (!mask || !is_all_zeros(&smask, sizeof smask)) { if
((OVS_KEY_ATTR_TUNNEL) == OVS_KEY_ATTR_TUNNEL) { tun_key_to_attr(key,
(const struct flow_tnl *)(void *)&(skey)); } else {
nl_msg_put_unspec(key, OVS_KEY_ATTR_TUNNEL, &(skey), sizeof (skey)); };
if (mask) { if ((OVS_KEY_ATTR_TUNNEL) == OVS_KEY_ATTR_TUNNEL) {
tun_key_to_attr(mask, (const struct flow_tnl *)(void *)&(smask)); } else
{ nl_msg_put_unspec(mask, OVS_KEY_ATTR_TUNNEL, &(smask), sizeof
(smask)); }; } }; return s - start; };
^
lib/odp-util.c:2700:364: error: self-comparison always evaluates to true
[-Werror,-Wtautological-compare]
} } while (*s++ == ',' && len != 0); if (s[-1] != ')') { return -22;
}; if (!mask || !is_all_zeros(&smask, sizeof smask)) { if
((OVS_KEY_ATTR_TUNNEL) == OVS_KEY_ATTR_TUNNEL) { tun_key_to_attr(key,
(const struct flow_tnl *)(void *)&(skey)); } else {
nl_msg_put_unspec(key, OVS_KEY_ATTR_TUNNEL, &(skey), sizeof (skey)); };
if (mask) { if ((OVS_KEY_ATTR_TUNNEL) == OVS_KEY_ATTR_TUNNEL) {
tun_key_to_attr(mask, (const struct flow_tnl *)(void *)&(smask)); } else
{ nl_msg_put_unspec(mask, OVS_KEY_ATTR_TUNNEL, &(smask), sizeof
(smask)); }; } }; return s - start; };
^
and finally, adding -Wno-tautological-compare the build completes
successfully.
--
Russell Bryant
More information about the dev
mailing list