Commit 3f995631 authored by Lev Walkin's avatar Lev Walkin

cross-compile-safe options

parent 5230c64b
...@@ -788,7 +788,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -788,7 +788,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
/* /*
* This function is only to get rid of Undefined Behavior Sanitizer warning. * This function is only to get rid of Undefined Behavior Sanitizer warning.
*/ */
static intmax_t CLANG_NO_SANITIZE("shift-base") static intmax_t CC_NO_SANITIZE("shift-base")
asn__safe_integer_convert_helper(const uint8_t *b, const uint8_t *end) { asn__safe_integer_convert_helper(const uint8_t *b, const uint8_t *end) {
intmax_t value; intmax_t value;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
/* /*
* This function is only to get rid of Undefined Behavior Sanitizer warning. * This function is only to get rid of Undefined Behavior Sanitizer warning.
*/ */
static intmax_t CLANG_NO_SANITIZE("shift-base") static intmax_t CC_NO_SANITIZE("shift-base")
asn__safe_nativeenumerated_convert_helper(const uint8_t *b, asn__safe_nativeenumerated_convert_helper(const uint8_t *b,
const uint8_t *end) { const uint8_t *end) {
intmax_t value; intmax_t value;
......
...@@ -82,7 +82,7 @@ OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -82,7 +82,7 @@ OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
int int
OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, unsigned int arclen, signed int add, void *rvbufp, unsigned int rvsize) { OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, unsigned int arclen, signed int add, void *rvbufp, unsigned int rvsize) {
unsigned LE GCC_NOTUSED = 1; /* Little endian (x86) */ unsigned LE CC_NOTUSED = 1; /* Little endian (x86) */
const uint8_t *arcend = arcbuf + arclen; /* End of arc */ const uint8_t *arcend = arcbuf + arclen; /* End of arc */
unsigned int cache = 0; /* No more than 14 significant bits */ unsigned int cache = 0; /* No more than 14 significant bits */
unsigned char *rvbuf = (unsigned char *)rvbufp; unsigned char *rvbuf = (unsigned char *)rvbufp;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define INT_MAX ((int)(((unsigned int)-1) >> 1)) #define INT_MAX ((int)(((unsigned int)-1) >> 1))
#if !(defined(NAN) || defined(INFINITY)) #if !(defined(NAN) || defined(INFINITY))
static volatile double real_zero GCC_NOTUSED = 0.0; static volatile double real_zero CC_NOTUSED = 0.0;
#endif #endif
#ifndef NAN #ifndef NAN
#define NAN (real_zero/real_zero) #define NAN (real_zero/real_zero)
...@@ -667,8 +667,8 @@ asn_double2REAL(REAL_t *st, double dbl_value) { ...@@ -667,8 +667,8 @@ asn_double2REAL(REAL_t *st, double dbl_value) {
uint8_t buf[16]; /* More than enough for 8-byte dbl_value */ uint8_t buf[16]; /* More than enough for 8-byte dbl_value */
uint8_t dscr[sizeof(dbl_value)]; /* double value scratch pad */ uint8_t dscr[sizeof(dbl_value)]; /* double value scratch pad */
/* Assertion guards: won't even compile, if unexpected double size */ /* Assertion guards: won't even compile, if unexpected double size */
char assertion_buffer1[9 - sizeof(dbl_value)] GCC_NOTUSED; char assertion_buffer1[9 - sizeof(dbl_value)] CC_NOTUSED;
char assertion_buffer2[sizeof(dbl_value) - 7] GCC_NOTUSED; char assertion_buffer2[sizeof(dbl_value) - 7] CC_NOTUSED;
uint8_t *ptr = buf; uint8_t *ptr = buf;
uint8_t *mstop; /* Last byte of mantissa */ uint8_t *mstop; /* Last byte of mantissa */
unsigned int mval; /* Value of the last byte of mantissa */ unsigned int mval; /* Value of the last byte of mantissa */
......
...@@ -134,7 +134,7 @@ asn_dec_rval_t asn_decode( ...@@ -134,7 +134,7 @@ asn_dec_rval_t asn_decode(
typedef void (asn_app_constraint_failed_f)(void *application_specific_key, typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
struct asn_TYPE_descriptor_s *type_descriptor_which_failed, struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
const void *structure_which_failed_ptr, const void *structure_which_failed_ptr,
const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); const char *error_message_format, ...) CC_PRINTFLIKE(4, 5);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -108,7 +108,7 @@ static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } ...@@ -108,7 +108,7 @@ static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
* Check stack against overflow, if limit is set. * Check stack against overflow, if limit is set.
*/ */
#define ASN__DEFAULT_STACK_MAX (30000) #define ASN__DEFAULT_STACK_MAX (30000)
static int GCC_NOTUSED static int CC_NOTUSED
ASN__STACK_OVERFLOW_CHECK(const asn_codec_ctx_t *ctx) { ASN__STACK_OVERFLOW_CHECK(const asn_codec_ctx_t *ctx) {
if(ctx && ctx->max_stack_size) { if(ctx && ctx->max_stack_size) {
......
...@@ -105,26 +105,13 @@ typedef unsigned int uint32_t; ...@@ -105,26 +105,13 @@ typedef unsigned int uint32_t;
#endif /* _WIN32 */ #endif /* _WIN32 */
#if __GNUC__ >= 3 || defined(__clang__) #if __GNUC__ >= 3 || defined(__clang__)
#ifndef GCC_PRINTFLIKE #define CC_ATTRIBUTE(attr) __attribute__((attr))
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
#endif
#ifndef GCC_NOTUSED
#define GCC_NOTUSED __attribute__((unused))
#endif
#else
#ifndef GCC_PRINTFLIKE
#define GCC_PRINTFLIKE(fmt,var) /* nothing */
#endif
#ifndef GCC_NOTUSED
#define GCC_NOTUSED
#endif
#endif
#if defined(__clang__)
#define CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
#else #else
#define CLANG_NO_SANITIZE(what) #define CC_ATTRIBUTE(attr)
#endif #endif
#define CC_PRINTFLIKE(fmt, var) CC_ATTRIBUTE(format(printf, fmt, var))
#define CC_NOTUSED CC_ATTRIBUTE(unused)
#define CC_NO_SANITIZE(what) CC_ATTRIBUTE(no_sanitize(what))
/* Figure out if thread safety is requested */ /* Figure out if thread safety is requested */
#if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT)) #if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT))
......
...@@ -134,7 +134,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, ...@@ -134,7 +134,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
return rv; return rv;
} }
static asn_dec_rval_t GCC_NOTUSED static asn_dec_rval_t CC_NOTUSED
uper_open_type_get_complex(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, uper_open_type_get_complex(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
uper_ugot_key arg; uper_ugot_key arg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment