KWIML 2018-01-09 (9c2d6cae)

Code extracted from:

    https://gitlab.kitware.com/utils/kwiml.git

at commit 9c2d6caecd8cd937b891009c681f90748df85dfd (master).

Upstream Shortlog
-----------------

Brad King (5):
      fc9d607a Use static_cast when compiling as C++
      ea9336bc Update copyright year
      7db8b884 Suppress MSVC static_cast warnings in verification and test code
      340af24d Update copyright year
      9c2d6cae Fix compilation on Borland C++ 5.8

Richard W.M. Jones (1):
      6fc81d88 abi.h: Update RISC-V support for revised macro names
This commit is contained in:
KWIML Upstream 2018-01-09 08:49:07 -05:00 committed by Brad King
parent 93542c897d
commit 6e921648d2
5 changed files with 38 additions and 9 deletions

View File

@ -1,5 +1,5 @@
Kitware Information Macro Library Kitware Information Macro Library
Copyright 2010-2016 Kitware, Inc. Copyright 2010-2018 Kitware, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
/*============================================================================ /*============================================================================
Kitware Information Macro Library Kitware Information Macro Library
Copyright 2010-2016 Kitware, Inc. Copyright 2010-2018 Kitware, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -468,7 +468,7 @@ suppression macro KWIML_ABI_NO_VERIFY was defined.
# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE
/* RISC-V */ /* RISC-V */
#elif defined(__riscv__) #elif defined(__riscv) || defined(__riscv__)
# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE
/* Unknown CPU */ /* Unknown CPU */
@ -484,9 +484,16 @@ suppression macro KWIML_ABI_NO_VERIFY was defined.
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (push) # pragma warning (push)
# pragma warning (disable:4309) /* static_cast trunction of constant value */
# pragma warning (disable:4310) /* cast truncates constant value */ # pragma warning (disable:4310) /* cast truncates constant value */
#endif #endif
#if defined(__cplusplus) && !defined(__BORLANDC__)
#define KWIML_ABI_private_STATIC_CAST(t,v) static_cast<t>(v)
#else
#define KWIML_ABI_private_STATIC_CAST(t,v) (t)(v)
#endif
#define KWIML_ABI_private_VERIFY(n, x, y) KWIML_ABI_private_VERIFY_0(KWIML_ABI_private_VERSION, n, x, y) #define KWIML_ABI_private_VERIFY(n, x, y) KWIML_ABI_private_VERIFY_0(KWIML_ABI_private_VERSION, n, x, y)
#define KWIML_ABI_private_VERIFY_0(V, n, x, y) KWIML_ABI_private_VERIFY_1(V, n, x, y) #define KWIML_ABI_private_VERIFY_0(V, n, x, y) KWIML_ABI_private_VERIFY_1(V, n, x, y)
#define KWIML_ABI_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] #define KWIML_ABI_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y]
@ -535,9 +542,11 @@ KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG_LONG, __int64, long lon
#endif #endif
#if defined(KWIML_ABI_CHAR_IS_UNSIGNED) #if defined(KWIML_ABI_CHAR_IS_UNSIGNED)
KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_UNSIGNED,
KWIML_ABI_private_STATIC_CAST(char, 0x80) > 0);
#elif defined(KWIML_ABI_CHAR_IS_SIGNED) #elif defined(KWIML_ABI_CHAR_IS_SIGNED)
KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_SIGNED,
KWIML_ABI_private_STATIC_CAST(char, 0x80) < 0);
#endif #endif
#undef KWIML_ABI_private_VERIFY_DIFF #undef KWIML_ABI_private_VERIFY_DIFF
@ -557,6 +566,8 @@ KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_SIGNED, (char)0x80 < 0);
#undef KWIML_ABI_private_VERIFY_0 #undef KWIML_ABI_private_VERIFY_0
#undef KWIML_ABI_private_VERIFY #undef KWIML_ABI_private_VERIFY
#undef KWIML_ABI_private_STATIC_CAST
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (pop) # pragma warning (pop)
#endif #endif

View File

@ -1,6 +1,6 @@
/*============================================================================ /*============================================================================
Kitware Information Macro Library Kitware Information Macro Library
Copyright 2010-2016 Kitware, Inc. Copyright 2010-2018 Kitware, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -1003,16 +1003,25 @@ An includer may test the following macros after inclusion:
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (push) # pragma warning (push)
# pragma warning (disable:4309) /* static_cast trunction of constant value */
# pragma warning (disable:4310) /* cast truncates constant value */ # pragma warning (disable:4310) /* cast truncates constant value */
#endif #endif
#if defined(__cplusplus) && !defined(__BORLANDC__)
#define KWIML_INT_private_STATIC_CAST(t,v) static_cast<t>(v)
#else
#define KWIML_INT_private_STATIC_CAST(t,v) (t)(v)
#endif
#define KWIML_INT_private_VERIFY(n, x, y) KWIML_INT_private_VERIFY_0(KWIML_INT_private_VERSION, n, x, y) #define KWIML_INT_private_VERIFY(n, x, y) KWIML_INT_private_VERIFY_0(KWIML_INT_private_VERSION, n, x, y)
#define KWIML_INT_private_VERIFY_0(V, n, x, y) KWIML_INT_private_VERIFY_1(V, n, x, y) #define KWIML_INT_private_VERIFY_0(V, n, x, y) KWIML_INT_private_VERIFY_1(V, n, x, y)
#define KWIML_INT_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] #define KWIML_INT_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y]
#define KWIML_INT_private_VERIFY_BOOL(m, b) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##m, 2, (b)?2:3) #define KWIML_INT_private_VERIFY_BOOL(m, b) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##m, 2, (b)?2:3)
#define KWIML_INT_private_VERIFY_TYPE(t, s) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##t, s, sizeof(t)) #define KWIML_INT_private_VERIFY_TYPE(t, s) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##t, s, sizeof(t))
#define KWIML_INT_private_VERIFY_SIGN(t, u, o) KWIML_INT_private_VERIFY_BOOL(SIGN_##t, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) #define KWIML_INT_private_VERIFY_SIGN(t, u, o) \
KWIML_INT_private_VERIFY_BOOL(SIGN_##t, KWIML_INT_private_STATIC_CAST( \
t, KWIML_INT_private_STATIC_CAST(u, 1) << ((sizeof(t)<<3)-1)) o 0)
KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int8_t, 1); KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int8_t, 1);
KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint8_t, 1); KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint8_t, 1);
@ -1060,6 +1069,8 @@ KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uintptr_t, KWIML_INT_uintptr_t, >);
#undef KWIML_INT_private_VERIFY_0 #undef KWIML_INT_private_VERIFY_0
#undef KWIML_INT_private_VERIFY #undef KWIML_INT_private_VERIFY
#undef KWIML_INT_private_STATIC_CAST
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (pop) # pragma warning (pop)
#endif #endif

View File

@ -1,6 +1,6 @@
/*============================================================================ /*============================================================================
Kitware Information Macro Library Kitware Information Macro Library
Copyright 2010-2016 Kitware, Inc. Copyright 2010-2018 Kitware, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -8,6 +8,7 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (push) # pragma warning (push)
# pragma warning (disable:4309) /* static_cast trunction of constant value */
# pragma warning (disable:4310) /* cast truncates constant value */ # pragma warning (disable:4310) /* cast truncates constant value */
#endif #endif
@ -17,7 +18,13 @@
# define LANG "C " # define LANG "C "
#endif #endif
#define VALUE(T, U) (T)((U)0xab << ((sizeof(T)-1)<<3)) #if defined(__cplusplus) && !defined(__BORLANDC__)
# define STATIC_CAST(t,v) static_cast<t>(v)
#else
# define STATIC_CAST(t,v) (t)(v)
#endif
#define VALUE(T, U) STATIC_CAST(T, STATIC_CAST(U, 0xab) << ((sizeof(T)-1)<<3))
#define TEST_C_(C, V, PRI, T, U) \ #define TEST_C_(C, V, PRI, T, U) \
{ \ { \