comparison libtomcrypt/src/headers/tomcrypt_argchk.h @ 1478:3a933956437e coverity

update coverity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 23:49:22 +0800
parents 6dba84798cd5
children 1ff2a1034c52
comparison
equal deleted inserted replaced
1439:8d24733026c5 1478:3a933956437e
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2 *
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
5 *
6 * The library is free for all purposes without any express
7 * guarantee it works.
8 */
9
1 /* Defines the LTC_ARGCHK macro used within the library */ 10 /* Defines the LTC_ARGCHK macro used within the library */
2 /* ARGTYPE is defined in mycrypt_cfg.h */ 11 /* ARGTYPE is defined in tomcrypt_cfg.h */
3 #if ARGTYPE == 0 12 #if ARGTYPE == 0
4 13
5 #include <signal.h> 14 #include <signal.h>
6 15
7 /* portability macros for compiler-specific code attributes */ 16 /* portability macros for compiler-specific code attributes */
11 #define ATTRIB_NORETURN 20 #define ATTRIB_NORETURN
12 #endif 21 #endif
13 22
14 23
15 /* this is the default LibTomCrypt macro */ 24 /* this is the default LibTomCrypt macro */
16 void crypt_argchk(char *v, char *s, int d) ATTRIB_NORETURN; 25 #if defined(__clang__) || defined(__GNUC_MINOR__)
17 #define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } 26 #define NORETURN __attribute__ ((noreturn))
18 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 27 #else
28 #define NORETURN
29 #endif
30
31 void crypt_argchk(const char *v, const char *s, int d) NORETURN;
32 #define LTC_ARGCHK(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0)
33 #define LTC_ARGCHKVD(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0)
19 34
20 #elif ARGTYPE == 1 35 #elif ARGTYPE == 1
21 36
22 /* fatal type of error */ 37 /* fatal type of error */
23 #define LTC_ARGCHK(x) assert((x)) 38 #define LTC_ARGCHK(x) assert((x))
39 #define LTC_ARGCHKVD(x) if (!(x)) return; 54 #define LTC_ARGCHKVD(x) if (!(x)) return;
40 55
41 #endif 56 #endif
42 57
43 58
44 /* $Source$ */ 59 /* ref: $Format:%D$ */
45 /* $Revision$ */ 60 /* git commit: $Format:%H$ */
46 /* $Date$ */ 61 /* commit time: $Format:%ai$ */