From: Hallvard Furuseth Date: Fri, 3 Sep 1999 21:06:33 +0000 (+0000) Subject: Introduce and use LDAP_GCCATTR() = __attributes__() in gcc X-Git-Tag: TWEB_OL_BASE~29 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=33cc7d4cf14e3e5b9309ab20b15f836eb11146ec;p=openldap Introduce and use LDAP_GCCATTR() = __attributes__() in gcc --- diff --git a/clients/fax500/main.c b/clients/fax500/main.c index 5bc84f2fb8..84cded263e 100644 --- a/clients/fax500/main.c +++ b/clients/fax500/main.c @@ -121,7 +121,7 @@ static void add_to(char ***list, int *nlist, char **new); static int isgroup(LDAPMessage *e); static void add_error(Error **err, int *nerr, int code, char *addr, LDAPMessage *msg); static void add_group(char *dn, Group **list, int *nlist); -static void unbind_and_exit(int rc); +static void unbind_and_exit(int rc) LDAP_GCCATTR((noreturn)); static int group_loop(char *dn); static void send_group(Group *group, int ngroup); static int has_attributes(LDAPMessage *e, char *attr1, char *attr2); diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 9bf49a252c..a7e9b868be 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -62,10 +62,10 @@ char *templatefile = TEMPLATEFILE; char myhost[MAXHOSTNAMELEN]; int myport; -static void usage ( char *name ); +static void usage ( char *name ) LDAP_GCCATTR((noreturn)); static int set_socket (int port); static RETSIGTYPE wait4child(int sig); -static void do_queries (int s); +static void do_queries (int s) LDAP_GCCATTR((noreturn)); static void do_error (FILE *fp, char *s); static void do_search (LDAP *ld, FILE *fp, char *buf); static void do_read (LDAP *ld, FILE *fp, char *dn); diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 24b627f02b..533dea8a72 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -63,10 +63,10 @@ char *templatefile = TEMPLATEFILE; char *friendlyfile = FRIENDLYFILE; int rdncount = GO500GW_RDNCOUNT; -static void usage ( char *name ); +static void usage ( char *name ) LDAP_GCCATTR((noreturn)); static int set_socket (int port); static RETSIGTYPE wait4child(int sig); -static void do_queries (int s); +static void do_queries (int s) LDAP_GCCATTR((noreturn)); static char *pick_oc ( char **oclist ); static int isnonleaf ( LDAP *ld, char **oclist, char *dn ); static void do_menu (LDAP *ld, FILE *fp, char *dn); diff --git a/clients/mail500/main.c b/clients/mail500/main.c index 678663805d..b3b3f446e2 100644 --- a/clients/mail500/main.c +++ b/clients/mail500/main.c @@ -178,7 +178,7 @@ static void add_to( char ***list, int *nlist, char **new ); static void add_single_to( char ***list, char *new ); static int isgroup( LDAPMessage *e ); static void add_error( Error **err, int *nerr, int code, char *addr, LDAPMessage *msg ); -static void unbind_and_exit( int rc ); +static void unbind_and_exit( int rc ) LDAP_GCCATTR((noreturn)); static void send_group( Group *group, int ngroup ); static int connect_to_x500( void ); @@ -1829,7 +1829,3 @@ unbind_and_exit( int rc ) exit( rc ); } - - - - diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 729a6d1cd8..bd6a0cb64a 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -60,7 +60,7 @@ static LDAP *ld; #define T_NEWSUPSTR "newsuperior" -static void usage LDAP_P(( const char *prog )); +static void usage LDAP_P(( const char *prog )) LDAP_GCCATTR((noreturn)); static int process_ldapmod_rec LDAP_P(( char *rbuf )); static int process_ldif_rec LDAP_P(( char *rbuf, int count )); static void addmodifyop LDAP_P(( LDAPMod ***pmodsp, int modop, char *attr, diff --git a/clients/ud/ud.h b/clients/ud/ud.h index 3dd04bbc37..3f9e6087dc 100644 --- a/clients/ud/ud.h +++ b/clients/ud/ud.h @@ -234,7 +234,7 @@ void print_help LDAP_P(( char *s )); #ifdef DEBUG #endif -void do_commands LDAP_P(( void )); +void do_commands LDAP_P(( void )) LDAP_GCCATTR((noreturn)); void status LDAP_P(( void )); void change_base LDAP_P(( int type, char **base, char *s )); void initialize_client LDAP_P(( void )); @@ -280,7 +280,7 @@ void ka_StringToKey LDAP_P(( char *str, char *cell, des_cblock *key )); /* in util.c: */ void printbase LDAP_P(( char *lead, char *s )); void fetch_buffer LDAP_P(( char *buffer, int length, FILE *where )); -void fatal LDAP_P(( char *s )); +void fatal LDAP_P(( char *s )) LDAP_GCCATTR((noreturn)); int isgroup LDAP_P(( void )); void format LDAP_P(( char *str, int width, int lead )); void format2 LDAP_P(( char *s, char *ft, char *t, int fi, int i, int w )); diff --git a/include/ac/setproctitle.h b/include/ac/setproctitle.h index 816b78b2e9..5bf1d2f496 100644 --- a/include/ac/setproctitle.h +++ b/include/ac/setproctitle.h @@ -19,7 +19,8 @@ # include #else /* use lutil version */ - LDAP_F(void) (setproctitle) LDAP_P((const char *fmt, ...)); + LDAP_F(void) (setproctitle) LDAP_P((const char *fmt, ...)) \ + LDAP_GCCATTR((format(printf, 1, 2))); LDAP_F(int) Argc; LDAP_F(char) **Argv; #endif diff --git a/include/lber_pvt.h b/include/lber_pvt.h index 30ec675f14..7e26591cea 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -30,7 +30,7 @@ ber_pvt_log_printf LDAP_P(( int errlvl, int loglvl, const char *fmt, - ... )); + ... )) LDAP_GCCATTR((format(printf, 3, 4))); LDAP_END_DECL diff --git a/include/ldap_cdefs.h b/include/ldap_cdefs.h index c0088a0bca..dc5722d82e 100644 --- a/include/ldap_cdefs.h +++ b/include/ldap_cdefs.h @@ -56,6 +56,13 @@ # define LDAP_F_EXPORT extern #endif +#if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006 +# define LDAP_GCCATTR(attrs) __attribute__(attrs) +#else +# define LDAP_GCCATTR(attrs) +#endif + + #endif /* _LDAP_CDEFS_H */ /* purposely allow these to be redefined */ diff --git a/include/ldap_log.h b/include/ldap_log.h index 9007711ba6..dfb2e7a9cd 100644 --- a/include/ldap_log.h +++ b/include/ldap_log.h @@ -76,7 +76,7 @@ extern int ldap_syslog_level; LDAP_F(void) lutil_debug LDAP_P(( int debug, int level, - const char* fmt, ... )); + const char* fmt, ... )) LDAP_GCCATTR((format(printf, 3, 4))); LDAP_END_DECL diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index e9146db127..155e916215 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -299,7 +299,8 @@ void ldap_int_utils_init LDAP_P(( void )); /* * in print.c */ -int ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...)); +int ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...)) + LDAP_GCCATTR((format(printf, 3, 4))); /* * in cache.c diff --git a/servers/ldapd/proto-ldapd.h b/servers/ldapd/proto-ldapd.h index 61f575f31e..21bb8b4655 100644 --- a/servers/ldapd/proto-ldapd.h +++ b/servers/ldapd/proto-ldapd.h @@ -86,7 +86,7 @@ int kerberos_check_mutual LDAP_P(( struct ds_bind_arg *res, u_long nonce )); * main.c */ -RETSIGTYPE log_and_exit LDAP_P(( int exitcode )); +RETSIGTYPE log_and_exit LDAP_P(( int exitcode )) LDAP_GCCATTR((noreturn)); /* * message.c diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index b4ffd971c0..3f92c707b6 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -19,7 +19,7 @@ static void split(char *line, int splitchar, char **left, char **right); static void acl_append(AccessControl **l, AccessControl *a); static void access_append(Access **l, Access *a); -static void acl_usage(void); +static void acl_usage(void) LDAP_GCCATTR((noreturn)); #ifdef LDAP_DEBUG static void print_acl(AccessControl *a); static void print_access(Access *b); diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index 938e8bbd39..3f65bc41ed 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -19,8 +19,9 @@ static Avlnode *object_classes = NULL; int global_schemacheck = 1; /* schemacheck on is default */ -static void oc_usage_old(void); -static void oc_usage(void); +static void oc_usage_old(void) LDAP_GCCATTR((noreturn)); +static void oc_usage(void) LDAP_GCCATTR((noreturn)); +static void at_usage(void) LDAP_GCCATTR((noreturn)); static char *err2text[] = { "", diff --git a/servers/slapd/shell-backends/shellutil.h b/servers/slapd/shell-backends/shellutil.h index 0832432ff0..451af0d3c8 100644 --- a/servers/slapd/shell-backends/shellutil.h +++ b/servers/slapd/shell-backends/shellutil.h @@ -75,7 +75,7 @@ struct ldentry { #ifdef LDAP_DEBUG -void debug_printf(const char *, ...); +void debug_printf(const char *, ...) LDAP_GCCATTR((format(printf, 1, 2))); #else /* LDAP_DEBUG */ #define debug_printf (void) /* Ignore "arguments" */ #endif /* LDAP_DEBUG */