cross-compile-safe options

This commit is contained in:
Lev Walkin 2017-09-26 18:27:32 -07:00
parent 5230c64b7c
commit 3f99563146
8 changed files with 14 additions and 27 deletions

View File

@ -788,7 +788,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
/*
* 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) {
intmax_t value;

View File

@ -12,7 +12,7 @@
/*
* 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,
const uint8_t *end) {
intmax_t value;

View File

@ -82,7 +82,7 @@ OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
int
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 */
unsigned int cache = 0; /* No more than 14 significant bits */
unsigned char *rvbuf = (unsigned char *)rvbufp;

View File

@ -20,7 +20,7 @@
#define INT_MAX ((int)(((unsigned int)-1) >> 1))
#if !(defined(NAN) || defined(INFINITY))
static volatile double real_zero GCC_NOTUSED = 0.0;
static volatile double real_zero CC_NOTUSED = 0.0;
#endif
#ifndef NAN
#define NAN (real_zero/real_zero)
@ -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 dscr[sizeof(dbl_value)]; /* double value scratch pad */
/* Assertion guards: won't even compile, if unexpected double size */
char assertion_buffer1[9 - sizeof(dbl_value)] GCC_NOTUSED;
char assertion_buffer2[sizeof(dbl_value) - 7] GCC_NOTUSED;
char assertion_buffer1[9 - sizeof(dbl_value)] CC_NOTUSED;
char assertion_buffer2[sizeof(dbl_value) - 7] CC_NOTUSED;
uint8_t *ptr = buf;
uint8_t *mstop; /* Last byte of mantissa */
unsigned int mval; /* Value of the last byte of mantissa */

View File

@ -134,7 +134,7 @@ asn_dec_rval_t asn_decode(
typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
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

View File

@ -108,7 +108,7 @@ static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
* Check stack against overflow, if limit is set.
*/
#define ASN__DEFAULT_STACK_MAX (30000)
static int GCC_NOTUSED
static int CC_NOTUSED
ASN__STACK_OVERFLOW_CHECK(const asn_codec_ctx_t *ctx) {
if(ctx && ctx->max_stack_size) {

View File

@ -105,26 +105,13 @@ typedef unsigned int uint32_t;
#endif /* _WIN32 */
#if __GNUC__ >= 3 || defined(__clang__)
#ifndef GCC_PRINTFLIKE
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
#endif
#ifndef GCC_NOTUSED
#define GCC_NOTUSED __attribute__((unused))
#endif
#define CC_ATTRIBUTE(attr) __attribute__((attr))
#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
#define CLANG_NO_SANITIZE(what)
#define CC_ATTRIBUTE(attr)
#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 */
#if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT))

View File

@ -134,7 +134,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
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,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
uper_ugot_key arg;