dhcp: fix compiler warning in IN_SET macro

clang warns:

    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
            assert_return (IN_SET(client->state, DHCP_STATE_INIT,
                           ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:376:17: note: expanded from macro 'IN_SET'
                    const typeof(_y) _x = (x);                              \
                    ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^
    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:379:47: note: expanded from macro 'IN_SET'
                    for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
                                                  ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^
    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:379:91: note: expanded from macro 'IN_SET'
                    for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
                                                                                              ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^
    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:380:31: note: expanded from macro 'IN_SET'
                            if (((const typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
                                  ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-10-29 21:29:58 +01:00 committed by Dan Williams
parent 9c3dbb0268
commit 78539e5ad6

View file

@ -373,11 +373,11 @@ do { \
#define IN_SET(x, y, ...) \
({ \
const typeof(y) _y = (y); \
const typeof(_y) _x = (x); \
typeof(_y) _x = (x); \
unsigned _i; \
bool _found = false; \
for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
if (((const typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
for (_i = 0; _i < 1 + sizeof((typeof(_x)[]) { __VA_ARGS__ })/sizeof(typeof(_x)); _i++) \
if (((typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
_found = true; \
break; \
} \