aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--agent/agent.h7
-rw-r--r--common/asshelp.h4
-rw-r--r--common/audit.c6
-rw-r--r--common/logging.h19
-rw-r--r--common/membuf.h2
-rw-r--r--common/mischelp.h41
-rw-r--r--common/stringhelp.h12
-rw-r--r--common/types.h14
-rw-r--r--common/util.h44
-rw-r--r--dirmngr/ks-engine-ldap.c2
-rw-r--r--dirmngr/ks-engine.h2
-rw-r--r--g10/main.h2
-rw-r--r--g13/g13.h2
-rw-r--r--scd/scdaemon.h2
-rw-r--r--sm/gpgsm.h2
15 files changed, 86 insertions, 75 deletions
diff --git a/agent/agent.h b/agent/agent.h
index 5a0925496..164ddea91 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -319,7 +319,8 @@ typedef int (*lookup_ttl_t)(const char *hexgrip);
/*-- gpg-agent.c --*/
-void agent_exit (int rc) GPGRT_GCC_A_NR; /* Also implemented in other tools */
+void agent_exit (int rc)
+ GPGRT_ATTR_NORETURN; /* Also implemented in other tools */
gpg_error_t agent_copy_startup_env (ctrl_t ctrl);
const char *get_agent_socket_name (void);
const char *get_agent_ssh_socket_name (void);
@@ -332,10 +333,10 @@ int map_pk_openpgp_to_gcry (int openpgp_algo);
/*-- command.c --*/
gpg_error_t agent_inq_pinentry_launched (ctrl_t ctrl, unsigned long pid);
gpg_error_t agent_write_status (ctrl_t ctrl, const char *keyword, ...)
- GNUPG_GCC_A_SENTINEL(0);
+ GPGRT_ATTR_SENTINEL(0);
gpg_error_t agent_print_status (ctrl_t ctrl, const char *keyword,
const char *format, ...)
- GPGRT_GCC_A_PRINTF(3,4);
+ GPGRT_ATTR_PRINTF(3,4);
void bump_key_eventcounter (void);
void bump_card_eventcounter (void);
void start_command_handler (ctrl_t, gnupg_fd_t, gnupg_fd_t);
diff --git a/common/asshelp.h b/common/asshelp.h
index c685564a6..6a52172f5 100644
--- a/common/asshelp.h
+++ b/common/asshelp.h
@@ -81,11 +81,11 @@ start_new_dirmngr (assuan_context_t *r_ctx,
gpg_error_t print_assuan_status (assuan_context_t ctx,
const char *keyword,
const char *format,
- ...) GPGRT_GCC_A_PRINTF(3,4);
+ ...) GPGRT_ATTR_PRINTF(3,4);
gpg_error_t vprint_assuan_status (assuan_context_t ctx,
const char *keyword,
const char *format,
- va_list arg_ptr) GPGRT_GCC_A_PRINTF(3,0);
+ va_list arg_ptr) GPGRT_ATTR_PRINTF(3,0);
#endif /*GNUPG_COMMON_ASSHELP_H*/
diff --git a/common/audit.c b/common/audit.c
index 9ed5708de..198b8e633 100644
--- a/common/audit.c
+++ b/common/audit.c
@@ -72,11 +72,11 @@ struct audit_ctx_s
static void writeout_para (audit_ctx_t ctx,
- const char *format, ...) GPGRT_GCC_A_PRINTF(2,3);
+ const char *format, ...) GPGRT_ATTR_PRINTF(2,3);
static void writeout_li (audit_ctx_t ctx, const char *oktext,
- const char *format, ...) GPGRT_GCC_A_PRINTF(3,4);
+ const char *format, ...) GPGRT_ATTR_PRINTF(3,4);
static void writeout_rem (audit_ctx_t ctx,
- const char *format, ...) GPGRT_GCC_A_PRINTF(2,3);
+ const char *format, ...) GPGRT_ATTR_PRINTF(2,3);
/* Add NAME to the list of help tags. NAME needs to be a const string
diff --git a/common/logging.h b/common/logging.h
index 0bd1a6c7f..dbfc8bae6 100644
--- a/common/logging.h
+++ b/common/logging.h
@@ -48,8 +48,9 @@ int log_test_fd (int fd);
int log_get_fd(void);
estream_t log_get_stream (void);
-#ifdef GPGRT_GCC_M_FUNCTION
- void bug_at( const char *file, int line, const char *func ) GPGRT_GCC_A_NR;
+#ifdef GPGRT_HAVE_MACRO_FUNCTION
+ void bug_at (const char *file, int line, const char *func)
+ GPGRT_ATTR_NORETURN;
# define BUG() bug_at( __FILE__ , __LINE__, __FUNCTION__ )
#else
void bug_at( const char *file, int line );
@@ -74,17 +75,17 @@ enum jnlib_log_levels {
GPGRT_LOG_BUG,
GPGRT_LOG_DEBUG
};
-void log_log (int level, const char *fmt, ...) GPGRT_GCC_A_PRINTF(2,3);
+void log_log (int level, const char *fmt, ...) GPGRT_ATTR_PRINTF(2,3);
void log_logv (int level, const char *fmt, va_list arg_ptr);
void log_string (int level, const char *string);
-void log_bug( const char *fmt, ... ) GPGRT_GCC_A_NR_PRINTF(1,2);
-void log_fatal( const char *fmt, ... ) GPGRT_GCC_A_NR_PRINTF(1,2);
-void log_error( const char *fmt, ... ) GPGRT_GCC_A_PRINTF(1,2);
-void log_info( const char *fmt, ... ) GPGRT_GCC_A_PRINTF(1,2);
-void log_debug( const char *fmt, ... ) GPGRT_GCC_A_PRINTF(1,2);
-void log_printf( const char *fmt, ... ) GPGRT_GCC_A_PRINTF(1,2);
+void log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2);
+void log_fatal (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2);
+void log_error (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
+void log_info (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
+void log_debug (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
+void log_printf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void log_flush (void);
/* Print a hexdump of BUFFER. With TEXT passes as NULL print just the
diff --git a/common/membuf.h b/common/membuf.h
index 32d4f90a2..eb7d5650a 100644
--- a/common/membuf.h
+++ b/common/membuf.h
@@ -55,7 +55,7 @@ void clear_membuf (membuf_t *mb, size_t amount);
void put_membuf (membuf_t *mb, const void *buf, size_t len);
void put_membuf_str (membuf_t *mb, const char *string);
void put_membuf_printf (membuf_t *mb, const char *format,
- ...) GPGRT_GCC_A_PRINTF(2,3);
+ ...) GPGRT_ATTR_PRINTF(2,3);
void *get_membuf (membuf_t *mb, size_t *len);
void *get_membuf_shrink (membuf_t *mb, size_t *len);
const void *peek_membuf (membuf_t *mb, size_t *len);
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. */
diff --git a/common/stringhelp.h b/common/stringhelp.h
index ab16d169c..a84c81b3f 100644
--- a/common/stringhelp.h
+++ b/common/stringhelp.h
@@ -52,11 +52,11 @@ size_t length_sans_trailing_ws (const unsigned char *line, size_t len);
char *make_basename(const char *filepath, const char *inputpath);
char *make_dirname(const char *filepath);
-char *make_filename( const char *first_part, ... ) GNUPG_GCC_A_SENTINEL(0);
-char *make_filename_try (const char *first_part, ... ) GNUPG_GCC_A_SENTINEL(0);
-char *make_absfilename (const char *first_part, ...) GNUPG_GCC_A_SENTINEL(0);
+char *make_filename( const char *first_part, ... ) GPGRT_ATTR_SENTINEL(0);
+char *make_filename_try (const char *first_part, ... ) GPGRT_ATTR_SENTINEL(0);
+char *make_absfilename (const char *first_part, ...) GPGRT_ATTR_SENTINEL(0);
char *make_absfilename_try (const char *first_part,
- ...) GNUPG_GCC_A_SENTINEL(0);
+ ...) GPGRT_ATTR_SENTINEL(0);
int compare_filenames( const char *a, const char *b );
int hextobyte (const char *s);
@@ -139,9 +139,9 @@ char *try_percent_escape (const char *str, const char *extra);
/* Concatenate the string S1 with all the following strings up to a
NULL. Returns a malloced buffer with the new string or NULL on a
malloc error or if too many arguments are given. */
-char *strconcat (const char *s1, ...) GNUPG_GCC_A_SENTINEL(0);
+char *strconcat (const char *s1, ...) GPGRT_ATTR_SENTINEL(0);
/* Ditto, but die on error. */
-char *xstrconcat (const char *s1, ...) GNUPG_GCC_A_SENTINEL(0);
+char *xstrconcat (const char *s1, ...) GPGRT_ATTR_SENTINEL(0);
char **strsplit (char *string, char delim, char replacement, int *count);
diff --git a/common/types.h b/common/types.h
index 8d7730b2e..2bb817faf 100644
--- a/common/types.h
+++ b/common/types.h
@@ -114,13 +114,13 @@
#endif
-/* Some GCC attributes. Note that we use also define some in
- mischelp.h, but this header and types.h are not always included.
- Should eventually be put into one file (e.g. nlib-common.h). */
-#if __GNUC__ >= 4
-# define GNUPG_GCC_A_SENTINEL(a) __attribute__ ((sentinel(a)))
-#else
-# define GNUPG_GCC_A_SENTINEL(a)
+/* Some GCC attributes. These are replacements for libgpg-error < 1.20. */
+#ifndef GPGRT_GCC_VERSION
+# if __GNUC__ >= 4
+# define GPGRT_ATTR_SENTINEL(a) __attribute__ ((sentinel(a)))
+# else
+# define GPGRT_ATTR_SENTINEL(a)
+# endif
#endif
#endif /*GNUPG_COMMON_TYPES_H*/
diff --git a/common/util.h b/common/util.h
index b92d78c4d..90acefa1a 100644
--- a/common/util.h
+++ b/common/util.h
@@ -152,26 +152,30 @@
#define snprintf gpgrt_snprintf
-/* GCC attributes. */
-#ifndef GNUPG_GCC_ATTR_FORMAT_ARG
-#if __GNUC__ >= 3 /* Actually 2.8 but testing the major is easier. */
-# define GNUPG_GCC_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a)))
-#else
-# define GNUPG_GCC_ATTR_FORMAT_ARG(a)
-#endif
-#endif
+/* Replacements for macros not available with libgpg-error < 1.20. */
+#ifndef GPGRT_GCC_VERSION
-#if __GNUC__ >= 4
-# define GNUPG_GCC_A_SENTINEL(a) __attribute__ ((sentinel(a)))
-#else
-# define GNUPG_GCC_A_SENTINEL(a)
-#endif
+# ifndef GPGRT_ATTR_FORMAT_ARG
+# if __GNUC__ >= 3 /* Actually 2.8 but testing the major is easier. */
+# define GPGRT_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a)))
+# else
+# define GPGRT_ATTR_FORMAT_ARG(a)
+# endif
+# endif
-#if __GNUC__ >= 4
-# define GNUPG_GCC_A_USED __attribute__ ((used))
-#else
-# define GNUPG_GCC_A_USED
-#endif
+# if __GNUC__ >= 4
+# define GPGRT_ATTR_SENTINEL(a) __attribute__ ((sentinel(a)))
+# else
+# define GPGRT_ATTR_SENTINEL(a)
+# endif
+
+# if __GNUC__ >= 4
+# define GPGRT_ATTR_USED __attribute__ ((used))
+# else
+# define GPGRT_ATTR_USED
+# endif
+
+#endif /*libgpg-error < 1.20 */
/* We need this type even if we are not using libreadline and or we
@@ -371,9 +375,9 @@ const char *gnupg_messages_locale_name (void);
void setup_libgcrypt_logging (void);
/* Same as estream_asprintf but die on memory failure. */
-char *xasprintf (const char *fmt, ...) GPGRT_GCC_A_PRINTF(1,2);
+char *xasprintf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
/* This is now an alias to estream_asprintf. */
-char *xtryasprintf (const char *fmt, ...) GPGRT_GCC_A_PRINTF(1,2);
+char *xtryasprintf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
/* Replacement for gcry_cipher_algo_name. */
const char *gnupg_cipher_algo_name (int algo);
diff --git a/dirmngr/ks-engine-ldap.c b/dirmngr/ks-engine-ldap.c
index 4288119ee..1b8ef031a 100644
--- a/dirmngr/ks-engine-ldap.c
+++ b/dirmngr/ks-engine-ldap.c
@@ -1404,7 +1404,7 @@ modlist_lookup (LDAPMod **modlist, const char *attr)
/* Dump a modlist to a file. This is useful for debugging. */
static estream_t modlist_dump (LDAPMod **modlist, estream_t output)
- GNUPG_GCC_A_USED;
+ GPGRT_ATTR_USED;
static estream_t
modlist_dump (LDAPMod **modlist, estream_t output)
diff --git a/dirmngr/ks-engine.h b/dirmngr/ks-engine.h
index 985167aa3..aff6cf472 100644
--- a/dirmngr/ks-engine.h
+++ b/dirmngr/ks-engine.h
@@ -26,7 +26,7 @@
/*-- ks-action.c --*/
gpg_error_t ks_print_help (ctrl_t ctrl, const char *text);
gpg_error_t ks_printf_help (ctrl_t ctrl, const char *format,
- ...) GPGRT_GCC_A_PRINTF(2,3);
+ ...) GPGRT_ATTR_PRINTF(2,3);
/*-- ks-engine-hkp.c --*/
gpg_error_t ks_hkp_resolve (ctrl_t ctrl, parsed_uri_t uri);
diff --git a/g10/main.h b/g10/main.h
index f4bf17f00..06c497dce 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -182,7 +182,7 @@ void write_status_error (const char *where, gpg_error_t err);
void write_status_errcode (const char *where, int errcode);
void write_status_text ( int no, const char *text );
void write_status_strings (int no, const char *text,
- ...) GNUPG_GCC_A_SENTINEL(0);
+ ...) GPGRT_ATTR_SENTINEL(0);
void write_status_buffer ( int no,
const char *buffer, size_t len, int wrap );
void write_status_text_and_buffer ( int no, const char *text,
diff --git a/g13/g13.h b/g13/g13.h
index 371833d84..c7668132d 100644
--- a/g13/g13.h
+++ b/g13/g13.h
@@ -106,7 +106,7 @@ void g13_exit (int rc);
void g13_init_default_ctrl (struct server_control_s *ctrl);
/*-- server.c (commonly used, thus declared here) --*/
-gpg_error_t g13_status (ctrl_t ctrl, int no, ...) GNUPG_GCC_A_SENTINEL(0);
+gpg_error_t g13_status (ctrl_t ctrl, int no, ...) GPGRT_ATTR_SENTINEL(0);
#endif /*G13_H*/
diff --git a/scd/scdaemon.h b/scd/scdaemon.h
index 35ada43b4..1a95ba7f6 100644
--- a/scd/scdaemon.h
+++ b/scd/scdaemon.h
@@ -124,7 +124,7 @@ const char *scd_get_socket_name (void);
void initialize_module_command (void);
int scd_command_handler (ctrl_t, int);
void send_status_info (ctrl_t ctrl, const char *keyword, ...)
- GNUPG_GCC_A_SENTINEL(1);
+ GPGRT_ATTR_SENTINEL(1);
void send_status_direct (ctrl_t ctrl, const char *keyword, const char *args);
void scd_update_reader_status_file (void);
diff --git a/sm/gpgsm.h b/sm/gpgsm.h
index 9fc74c3d6..30e4fb345 100644
--- a/sm/gpgsm.h
+++ b/sm/gpgsm.h
@@ -241,7 +241,7 @@ int gpgsm_parse_validation_model (const char *model);
/*-- server.c --*/
void gpgsm_server (certlist_t default_recplist);
gpg_error_t gpgsm_status (ctrl_t ctrl, int no, const char *text);
-gpg_error_t gpgsm_status2 (ctrl_t ctrl, int no, ...) GNUPG_GCC_A_SENTINEL(0);
+gpg_error_t gpgsm_status2 (ctrl_t ctrl, int no, ...) GPGRT_ATTR_SENTINEL(0);
gpg_error_t gpgsm_status_with_err_code (ctrl_t ctrl, int no, const char *text,
gpg_err_code_t ec);
gpg_error_t gpgsm_proxy_pinentry_notify (ctrl_t ctrl,