1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
/*
Copyright Rene Rivera 2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef MSGPACK_PREDEF_WORKAROUND_H
#define MSGPACK_PREDEF_WORKAROUND_H
/*`
[heading `MSGPACK_PREDEF_WORKAROUND`]
``
MSGPACK_PREDEF_WORKAROUND(symbol,comp,major,minor,patch)
``
Usage:
``
#if MSGPACK_PREDEF_WORKAROUND(MSGPACK_COMP_CLANG,<,3,0,0)
// Workaround for old clang compilers..
#endif
``
Defines a comparison against two version numbers that depends on the definion
of `MSGPACK_STRICT_CONFIG`. When `MSGPACK_STRICT_CONFIG` is defined this will expand
to a value convertible to `false`. Which has the effect of disabling all code
conditionally guarded by `MSGPACK_PREDEF_WORKAROUND`. When `MSGPACK_STRICT_CONFIG`
is undefine this expand to test the given `symbol` version value with the
`comp` comparison against `MSGPACK_VERSION_NUMBER(major,minor,patch)`.
*/
#ifdef MSGPACK_STRICT_CONFIG
# define MSGPACK_PREDEF_WORKAROUND(symbol, comp, major, minor, patch) (0)
#else
# include <msgpack/predef/version_number.h>
# define MSGPACK_PREDEF_WORKAROUND(symbol, comp, major, minor, patch) \
( (symbol) != (0) ) && \
( (symbol) comp (MSGPACK_VERSION_NUMBER( (major) , (minor) , (patch) )) )
#endif
/*`
[heading `MSGPACK_PREDEF_TESTED_AT`]
``
MSGPACK_PREDEF_TESTED_AT(symbol,major,minor,patch)
``
Usage:
``
#if MSGPACK_PREDEF_TESTED_AT(MSGPACK_COMP_CLANG,3,5,0)
// Needed for clang, and last checked for 3.5.0.
#endif
``
Defines a comparison against two version numbers that depends on the definion
of `MSGPACK_STRICT_CONFIG` and `MSGPACK_DETECT_OUTDATED_WORKAROUNDS`.
When `MSGPACK_STRICT_CONFIG` is defined this will expand to a value convertible
to `false`. Which has the effect of disabling all code
conditionally guarded by `MSGPACK_PREDEF_TESTED_AT`. When `MSGPACK_STRICT_CONFIG`
is undefined this expand to either:
* A value convertible to `true` when `MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is not
defined.
* A value convertible `true` when the expansion of
`MSGPACK_PREDEF_WORKAROUND(symbol, <=, major, minor, patch)` is `true` and
`MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is defined.
* A compile error when the expansion of
`MSGPACK_PREDEF_WORKAROUND(symbol, >, major, minor, patch)` is true and
`MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is defined.
*/
#ifdef MSGPACK_STRICT_CONFIG
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) (0)
#else
# ifdef MSGPACK_DETECT_OUTDATED_WORKAROUNDS
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) ( \
MSGPACK_PREDEF_WORKAROUND(symbol, <=, major, minor, patch) \
? 1 \
: (1%0) )
# else
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) \
( (symbol) >= MSGPACK_VERSION_NUMBER_AVAILABLE )
# endif
#endif
#endif
|