Synchronize warning flags between Xcode and Clang
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
parent
1200bfd109
commit
4e741e9137
3 changed files with 50 additions and 15 deletions
|
@ -10,6 +10,7 @@
|
|||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
#include "dds/dds.h"
|
||||
#include "dds/ddsrt/misc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "CUnit/Test.h"
|
||||
|
@ -82,14 +83,18 @@ CU_Test(ddsc_subscriber, create) {
|
|||
dds_delete_qos(sqos);
|
||||
|
||||
sqos = dds_create_qos();
|
||||
DDSRT_WARNING_CLANG_OFF(assign-enum);
|
||||
dds_qset_destination_order(sqos, 3); /* Set invalid dest. order (ignored, not applicable for subscriber) */
|
||||
DDSRT_WARNING_CLANG_ON(assign-enum);
|
||||
subscriber = dds_create_subscriber(participant, sqos, NULL);
|
||||
CU_ASSERT_FATAL(subscriber > 0);
|
||||
dds_delete(subscriber);
|
||||
dds_delete_qos(sqos);
|
||||
|
||||
sqos = dds_create_qos();
|
||||
DDSRT_WARNING_CLANG_OFF(assign-enum);
|
||||
dds_qset_presentation(sqos, 123, 1, 1); /* Set invalid presentation policy */
|
||||
DDSRT_WARNING_CLANG_ON(assign-enum);
|
||||
subscriber = dds_create_subscriber(participant, sqos, NULL);
|
||||
CU_ASSERT_EQUAL_FATAL(subscriber, DDS_RETCODE_BAD_PARAMETER);
|
||||
dds_delete_qos(sqos);
|
||||
|
|
|
@ -18,29 +18,45 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
|
||||
# define DDSRT_GNUC_STR(s) #s
|
||||
# define DDSRT_GNUC_JOINSTR(x,y) DDSRT_GNUC_STR(x ## y)
|
||||
# define DDSRT_GNUC_DO_PRAGMA(x) _Pragma (#x)
|
||||
# define DDSRT_GNUC_PRAGMA(x) DDSRT_GNUC_DO_PRAGMA(GCC diagnostic x)
|
||||
# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
|
||||
#if defined(__clang__) || \
|
||||
defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
|
||||
# define DDSRT_STR(s) #s
|
||||
# define DDSRT_JOINSTR(x,y) DDSRT_STR(x ## y)
|
||||
# define DDSRT_DO_PRAGMA(x) _Pragma(#x)
|
||||
# define DDSRT_PRAGMA(x) DDSRT_DO_PRAGMA(GCC diagnostic x)
|
||||
|
||||
# if defined(__clang__)
|
||||
# define DDSRT_WARNING_CLANG_OFF(x) \
|
||||
DDSRT_PRAGMA(push) \
|
||||
DDSRT_PRAGMA(ignored DDSRT_JOINSTR(-W,x))
|
||||
# define DDSRT_WARNING_CLANG_ON(x) \
|
||||
DDSRT_PRAGMA(pop)
|
||||
# elif ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
|
||||
# define DDSRT_WARNING_GNUC_OFF(x) \
|
||||
DDSRT_GNUC_PRAGMA(push) \
|
||||
DDSRT_GNUC_PRAGMA(ignored DDSRT_GNUC_JOINSTR(-W,x))
|
||||
DDSRT_PRAGMA(push) \
|
||||
DDSRT_PRAGMA(ignored DDSRT_JOINSTR(-W,x))
|
||||
# define DDSRT_WARNING_GNUC_ON(x) \
|
||||
DDSRT_GNUC_PRAGMA(pop)
|
||||
DDSRT_PRAGMA(pop)
|
||||
# else
|
||||
# define DDSRT_WARNING_GNUC_OFF(x) \
|
||||
DDSRT_GNUC_PRAGMA(ignored DDSRT_GNUC_JOINSTR(-W,x))
|
||||
DDSRT_PRAGMA(ignored DDSRT_JOINSTR(-W,x))
|
||||
# define DDSRT_WARNING_GNUC_ON(x) \
|
||||
DDSRT_GNUC_PRAGMA(warning DDSRT_GNUC_JOINSTR(-W,x))
|
||||
DDSRT_PRAGMA(warning DDSRT_JOINSTR(-W,x))
|
||||
# endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if !defined(DDSRT_WARNING_CLANG_OFF) && \
|
||||
!defined(DDSRT_WARNING_CLANG_ON)
|
||||
# define DDSRT_WARNING_CLANG_OFF(x)
|
||||
# define DDSRT_WARNING_CLANG_ON(x)
|
||||
#endif
|
||||
|
||||
#if !defined(DDSRT_WARNING_GNUC_OFF) && \
|
||||
!defined(DDSRT_WARNING_GNUC_ON)
|
||||
# define DDSRT_WARNING_GNUC_OFF(x)
|
||||
# define DDSRT_WARNING_GNUC_ON(x)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define DDSRT_WARNING_MSVC_OFF(x) \
|
||||
__pragma (warning(push)) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue