mirror of
https://github.com/systemd/systemd.git
synced 2024-12-12 03:33:44 +08:00
fundamental: adjust #if conditional for _fallthrough_ for clang
NetworkManager takes systemd sources. It gets compiler warnings
related to _fallthrough_. They probably can also affect systemd
itself.
A) on RHEL-7, gcc 4.8.5-44.el7 we get:
../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:45:22: error: "__clang__" is not defined [-Werror=undef]
#if __GNUC__ >= 7 || __clang__
^
Presumably gcc older than 7 is supported, so fix this.
B) on Ubuntu 18.04, clang 1:6.0-41~exp5~ubuntu1 we get:
../src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c:746:17: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
_fallthrough_;
^
../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:46:25: note: expanded from macro '_fallthrough_'
# define _fallthrough_ __attribute__((__fallthrough__))
^
Granted, README comments that clang >= 10 is required. However,
parts of systemd build just fine with older clang. It seems unnecessary
to break this and the fix helps NetworkManager.
Fixes: c0f5d58c9a
('meson: Document why -Wimplicit-fallthrough is not used with clang')
This commit is contained in:
parent
132b63bd31
commit
da519f8c81
@ -42,7 +42,7 @@
|
||||
# define _alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__)))
|
||||
#endif
|
||||
|
||||
#if __GNUC__ >= 7 || __clang__
|
||||
#if __GNUC__ >= 7 || (defined(__clang__) && __clang_major__ >= 10)
|
||||
# define _fallthrough_ __attribute__((__fallthrough__))
|
||||
#else
|
||||
# define _fallthrough_
|
||||
|
Loading…
Reference in New Issue
Block a user