Try to fix diagnostic suppression.
Test the compiler for "-Wpedantic" instead of "-pedantic" since DIAG_OFF and DIAG_ON expect a "-W" flag prefix. Be more strict about the compiler versions that DIAG_OFF and DIAG_ON support. Change-Id: I9304c544912102f1719b79e9250f97b40a324430 Reviewed-on: https://code.wireshark.org/review/7123 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
1b43a80c0d
commit
65763cf6ac
|
@ -278,7 +278,7 @@ else()
|
|||
|
||||
set(WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS
|
||||
# The following are for C and C++
|
||||
-pedantic
|
||||
-Wpedantic
|
||||
#
|
||||
# Various code blocks this one.
|
||||
#
|
||||
|
|
|
@ -867,7 +867,7 @@ AC_ARG_ENABLE(extra-compiler-warnings,
|
|||
#
|
||||
# The following are for C and C++
|
||||
#
|
||||
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-pedantic)
|
||||
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpedantic)
|
||||
#
|
||||
# Various code blocks this one.
|
||||
#
|
||||
|
|
|
@ -45,28 +45,29 @@ extern "C" {
|
|||
pragma clang diagnostic error/warning/ignored -Wxxx and
|
||||
pragma clang diagnostic push/pop were introduced in clang 2.8 */
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 && !defined(__clang__)
|
||||
/* gcc version is >= 4.2.0; we can use "GCC diagnostic ignored/warning
|
||||
-Wxxx" */
|
||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
|
||||
# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
|
||||
/* gcc version is >= 4.6.0: we can use "GCC diagnostic push/pop" */
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# define gcc_version ((__GNUC__ * 1000) + (__GNUC_MINOR__ * 10))
|
||||
# if gcc_version >= 4080
|
||||
/*
|
||||
* gcc version is >= 4.8.0. We can use "GCC diagnostic push/pop" *and*
|
||||
* gcc supports "-Wpedantic".
|
||||
*/
|
||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
|
||||
# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
||||
# define DIAG_ON(x) DIAG_PRAGMA(pop)
|
||||
# else
|
||||
/* gcc version is between 4.2.0 and 4.6.0:
|
||||
we can use "GCC diagnostic ignored/warning -Wxxx", but not
|
||||
"GCC diagnostic push/pop" */
|
||||
# define DIAG_OFF(x) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
||||
# define DIAG_ON(x) DIAG_PRAGMA(warning DIAG_JOINSTR(-W,x))
|
||||
# endif
|
||||
#elif defined(__clang__) && ((__clang_major__ * 100) + __clang_minor__ >= 208)
|
||||
/* clang version is >= 2.8: we can use "clang diagnostic ignored -Wxxx"
|
||||
and "clang diagnostic push/pop" */
|
||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(clang diagnostic x)
|
||||
# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
||||
# define DIAG_ON(x) DIAG_PRAGMA(pop)
|
||||
#else
|
||||
#elif defined(__clang__)
|
||||
# define clang_version ((__clang_major__ * 1000) + (__clang_minor__ * 10))
|
||||
# if clang_version >= 2080
|
||||
/* clang version is >= 2.8: we can use "clang diagnostic ignored -Wxxx"
|
||||
and "clang diagnostic push/pop" */
|
||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(clang diagnostic x)
|
||||
# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
||||
# define DIAG_ON(x) DIAG_PRAGMA(pop)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef DIAG_OFF
|
||||
/* no gcc or clang, or gcc version < 4.2.0, or clang version < 2.8:
|
||||
we can't do anything */
|
||||
# define DIAG_OFF(x)
|
||||
|
|
Loading…
Reference in New Issue