Browse Source

oops, NORETURN isn't only used in crypt_argchk()

Steffen Jaeckel 6 years ago
parent
commit
d58103d54f
3 changed files with 10 additions and 9 deletions
  1. 1 1
      demos/ltcrypt.c
  2. 3 8
      src/headers/tomcrypt_argchk.h
  3. 6 0
      src/headers/tomcrypt_cfg.h

+ 1 - 1
demos/ltcrypt.c

@@ -18,7 +18,7 @@
 
 #include <tomcrypt.h>
 
-static int NORETURN usage(char *name)
+static int LTC_NORETURN usage(char *name)
 {
    int x;
 

+ 3 - 8
src/headers/tomcrypt_argchk.h

@@ -9,18 +9,13 @@
 
 /* Defines the LTC_ARGCHK macro used within the library */
 /* ARGTYPE is defined in tomcrypt_cfg.h */
+
+/* ARGTYPE is per default defined to 0  */
 #if ARGTYPE == 0
 
 #include <signal.h>
 
-/* this is the default LibTomCrypt macro  */
-#if defined(__clang__) || defined(__GNUC_MINOR__)
-#define NORETURN __attribute__ ((noreturn))
-#else
-#define NORETURN
-#endif
-
-void crypt_argchk(const char *v, const char *s, int d) NORETURN;
+void crypt_argchk(const char *v, const char *s, int d) LTC_NORETURN;
 #define LTC_ARGCHK(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0)
 #define LTC_ARGCHKVD(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0)
 

+ 6 - 0
src/headers/tomcrypt_cfg.h

@@ -61,6 +61,12 @@ LTC_EXPORT int   LTC_CALL XSTRCMP(const char *s1, const char *s2);
    #define LTC_INLINE
 #endif
 
+#if defined(__clang__) || defined(__GNUC_MINOR__)
+#define LTC_NORETURN __attribute__ ((noreturn))
+#else
+#define LTC_NORETURN
+#endif
+
 /* type of argument checking, 0=default, 1=fatal and 2=error+continue, 3=nothing */
 #ifndef ARGTYPE
    #define ARGTYPE  0