Fix conflict between constant deprecation and check-names.sh

The previous introduction of constant deprecation macros
in platform_util.h lead to failure of tests/scrips/check-names.sh
because the regular expressions in the latter choked on the brackets
in the part `__attribute__((deprecated))` of the definition of the
helper type `mbedtls_deprecated_{numeric|string}_constant_t`.

Postponing any further study and potential robustness improvements
in check-names.sh to another time, this commit circumvents this
problem by temporarily abbreviating  `__attribute__((deprecated))`
as `MBEDTLS_DEPRECATED`, which doesn't lead to problems with
check-names.sh.
This commit is contained in:
Hanno Becker 2018-12-17 22:49:13 +00:00
parent 4fb258a868
commit 9dbefa1793

View File

@ -44,18 +44,18 @@ extern "C" {
/* Internal helper macros for deprecating API constants. */ /* Internal helper macros for deprecating API constants. */
#if !defined(MBEDTLS_DEPRECATED_REMOVED) #if !defined(MBEDTLS_DEPRECATED_REMOVED)
#if defined(MBEDTLS_DEPRECATED_WARNING) #if defined(MBEDTLS_DEPRECATED_WARNING)
/* Deliberately don't (yet) define MBEDTLS_DEPRECATED here to avoid /* Deliberately don't (yet) export MBEDTLS_DEPRECATED here
* conflict with other headers which define and use it, too. * to avoid conflict with other headers which define and use
* We might want to move all these definitions here at some point * it, too. We might want to move all these definitions here at
* for uniformity. */ * some point for uniformity. */
__attribute__((deprecated)) #define MBEDTLS_DEPRECATED __attribute__((deprecated))
typedef char const * mbedtls_deprecated_string_constant_t; MBEDTLS_DEPRECATED typedef char const * mbedtls_deprecated_string_constant_t;
#define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) \ #define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) \
( (mbedtls_deprecated_string_constant_t) ( VAL ) ) ( (mbedtls_deprecated_string_constant_t) ( VAL ) )
__attribute__((deprecated)) MBEDTLS_DEPRECATED typedef int mbedtls_deprecated_numeric_constant_t;
typedef int mbedtls_deprecated_numeric_constant_t;
#define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( VAL ) \ #define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( VAL ) \
( (mbedtls_deprecated_numeric_constant_t) ( VAL ) ) ( (mbedtls_deprecated_numeric_constant_t) ( VAL ) )
#undef MBEDTLS_DEPRECATED
#else /* MBEDTLS_DEPRECATED_WARNING */ #else /* MBEDTLS_DEPRECATED_WARNING */
#define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) VAL #define MBEDTLS_DEPRECATED_STRING_CONSTANT( VAL ) VAL
#define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( VAL ) VAL #define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( VAL ) VAL