mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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.
This commit is contained in:
parent
ef080d5c7f
commit
d382242fb6
@ -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);
|
||||
|
@ -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*/
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)))
|
||||
# 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)))
|
||||
# endif
|
||||
#else
|
||||
# define GPGRT_GCC_A_NR
|
||||
# define GPGRT_GCC_A_PRINTF( f, a )
|
||||
# define GPGRT_GCC_A_NR_PRINTF( f, a )
|
||||
#endif
|
||||
/* 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_ATTR_NORETURN
|
||||
# define GPGRT_ATTR_PRINTF( f, a )
|
||||
# define GPGRT_ATTR_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. */
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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*/
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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*/
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user