Skip to content

Commit d47e9c7

Browse files
committed
build: replace explicit gcc check by warning check
Check if the compiler has that warning instead of checking by the gcc version. This allows clang to ignore those warnings as it understands the same pragma.
1 parent b704efe commit d47e9c7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

configure.ac

+4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ AC_LANG_PUSH([C++])
140140
CC_CHECK_FLAGS_APPEND(with_cxxflags, [CXXFLAGS], [ \
141141
-Wall \
142142
-W \
143+
-Waddress-of-packed-member \
143144
-Wextra \
144145
-Wno-inline \
145146
-Wundef \
@@ -168,6 +169,9 @@ CC_CHECK_FLAGS_APPEND(with_cxxflags, [CXXFLAGS], [ \
168169
-Wtype-limits \
169170
-Wuninitialized])
170171
AC_LANG_POP([C++])
172+
173+
AS_VAR_IF([cc_cv_CXXFLAGS__Waddress_of_packed_member], [yes],
174+
[with_cxxflags="$with_cxxflags -DHAVE_WADDRESS_OF_PACKED_MEMBER"])
171175
AC_SUBST([OUR_CXXFLAGS], "$with_cxxflags")
172176

173177
#####################################################################

src/common/mavlink.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* mips, arm, etc that doesn't silently handle unaligned access,
1414
* you may be interested checking case by case in mavlink/pymavlink.
1515
*/
16-
#if defined(__GNUC__) && __GNUC__ >= 9
16+
#if defined(HAVE_WADDRESS_OF_PACKED_MEMBER) && HAVE_WADDRESS_OF_PACKED_MEMBER
1717
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
1818
#endif
1919
#include <mavlink.h>

0 commit comments

Comments
 (0)