aboutsummaryrefslogtreecommitdiffstats
path: root/common/mischelp.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-07-26 10:50:16 +0000
committerWerner Koch <[email protected]>2015-07-26 10:50:24 +0000
commitd382242fb6789973ce8d246ec154a4a1468c24c0 (patch)
tree3809b220992ea4e49942a3dec3d7a2f5e96738f6 /common/mischelp.h
parentscd: support any curves defined by libgcrypt. (diff)
downloadgnupg-d382242fb6789973ce8d246ec154a4a1468c24c0.tar.gz
gnupg-d382242fb6789973ce8d246ec154a4a1468c24c0.zip
Replace GNUPG_GCC_A_ macros by GPGRT_ATTR_ macros.
* common/util.h: Provide replacement for GPGRT_ATTR_ macros when using libgpg-error < 1.20. * common/mischelp.h: Ditto. * common/types.h: Ditto. -- Given that libgpg-error is a dependency of all GnuPG related libraries it is better to define such macros at only one place instead of having similar macros at a lot of places. For now we need repalcement macros, though.
Diffstat (limited to '')
-rw-r--r--common/mischelp.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/common/mischelp.h b/common/mischelp.h
index ecbf38b5c..cd72a4a65 100644
--- a/common/mischelp.h
+++ b/common/mischelp.h
@@ -48,27 +48,32 @@ time_t timegm (struct tm *tm);
#define DIMof(type,member) DIM(((type *)0)->member)
-#undef GPGRT_GCC_HAVE_PUSH_PRAGMA
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
-# define GPGRT_GCC_M_FUNCTION 1 /* __FUNCTION__ macro is available. */
-# define GPGRT_GCC_A_NR __attribute__ ((noreturn))
-# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4 )
-# define GPGRT_GCC_HAVE_PUSH_PRAGMA 1
-# define GPGRT_GCC_A_PRINTF( f, a ) \
- __attribute__ ((format (__gnu_printf__,f,a)))
-# define GPGRT_GCC_A_NR_PRINTF( f, a ) \
- __attribute__ ((noreturn, format (__gnu_printf__,f,a)))
+/* Replacements for macros not available with libgpg-error < 1.20. */
+#ifndef GPGRT_GCC_VERSION
+
+# undef GPGRT_HAVE_PRAGMA_GCC_PUSH
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
+# define GPGRT_HAVE_MACRO_FUNCTION 1 /* __FUNCTION__ macro is available. */
+# define GPGRT_ATTR_NORETURN __attribute__ ((noreturn))
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4 )
+# define GPGRT_HAVE_PRAGMA_GCC_PUSH 1
+# define GPGRT_ATTR_PRINTF(f,a) \
+ __attribute__ ((format (__gnu_printf__,f,a)))
+# define GPGRT_ATTR_NR_PRINTF(f,a) \
+ __attribute__ ((noreturn, format (__gnu_printf__,f,a)))
+# else
+# define GPGRT_ATTR_PRINTF(f, a) \
+ __attribute__ ((format (printf,f,a)))
+# define GPGRT_ATTR_NR_PRINTF(f, a) \
+ __attribute__ ((noreturn, format (printf,f,a)))
+# endif
# else
-# define GPGRT_GCC_A_PRINTF( f, a ) __attribute__ ((format (printf,f,a)))
-# define GPGRT_GCC_A_NR_PRINTF( f, a ) \
- __attribute__ ((noreturn, format (printf,f,a)))
+# define GPGRT_ATTR_NORETURN
+# define GPGRT_ATTR_PRINTF( f, a )
+# define GPGRT_ATTR_NR_PRINTF( f, a )
# endif
-#else
-# define GPGRT_GCC_A_NR
-# define GPGRT_GCC_A_PRINTF( f, a )
-# define GPGRT_GCC_A_NR_PRINTF( f, a )
-#endif
+#endif /*Older libgpg-error. */
/* To avoid that a compiler optimizes certain memset calls away, these
macros may be used instead. */