Skip to content

Commit

Permalink
Use __attribute__ ((__name__)) form
Browse files Browse the repository at this point in the history
Protect against macros named noreturn and so on.
  • Loading branch information
nicowilliams committed Mar 17, 2017
1 parent c3bb54e commit c9fc77d
Show file tree
Hide file tree
Showing 21 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion NEWS
Expand Up @@ -233,7 +233,7 @@ Release Notes - Heimdal - Version Heimdal 1.3

- Support for settin friendly name on credential caches
- Move to using doxygen to generate documentation.
- Sprinkling __attribute__((depricated)) for old function to be removed
- Sprinkling __attribute__((__deprecated__)) for old function to be removed
- Support to export LAST-REQUST information in AS-REQ
- Support for client deferrals in in AS-REQ
- Add seek support for krb5_storage.
Expand Down
16 changes: 8 additions & 8 deletions include/bits.c
Expand Up @@ -68,13 +68,13 @@ RCSID("$Id$");
#endif

static void
try_signed(FILE *f, int len) __attribute__ ((unused));
try_signed(FILE *f, int len) __attribute__ ((__unused__));

static void
try_unsigned(FILE *f, int len) __attribute__ ((unused));
try_unsigned(FILE *f, int len) __attribute__ ((__unused__));

static int
print_bt(FILE *f, int flag) __attribute__ ((unused));
print_bt(FILE *f, int flag) __attribute__ ((__unused__));

static void
try_signed(FILE *f, int len)
Expand Down Expand Up @@ -262,7 +262,7 @@ int main(int argc, char **argv)

fprintf(f, "#ifndef HEIMDAL_DEPRECATED\n");
fprintf(f, "#if __has_extension(deprecated) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
fprintf(f, "#define HEIMDAL_DEPRECATED __attribute__((deprecated))\n");
fprintf(f, "#define HEIMDAL_DEPRECATED __attribute__ ((__deprecated__))\n");
fprintf(f, "#elif defined(_MSC_VER) && (_MSC_VER>1200)\n");
fprintf(f, "#define HEIMDAL_DEPRECATED __declspec(deprecated)\n");
fprintf(f, "#else\n");
Expand All @@ -272,31 +272,31 @@ int main(int argc, char **argv)

fprintf(f, "#ifndef HEIMDAL_PRINTF_ATTRIBUTE\n");
fprintf(f, "#if __has_extension(format) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
fprintf(f, "#define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__((format x))\n");
fprintf(f, "#define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__ ((__format__ x))\n");
fprintf(f, "#else\n");
fprintf(f, "#define HEIMDAL_PRINTF_ATTRIBUTE(x)\n");
fprintf(f, "#endif\n");
fprintf(f, "#endif\n\n");

fprintf(f, "#ifndef HEIMDAL_NORETURN_ATTRIBUTE\n");
fprintf(f, "#if __has_extension(noreturn) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
fprintf(f, "#define HEIMDAL_NORETURN_ATTRIBUTE __attribute__((noreturn))\n");
fprintf(f, "#define HEIMDAL_NORETURN_ATTRIBUTE __attribute__ ((__noreturn__))\n");
fprintf(f, "#else\n");
fprintf(f, "#define HEIMDAL_NORETURN_ATTRIBUTE\n");
fprintf(f, "#endif\n");
fprintf(f, "#endif\n\n");

fprintf(f, "#ifndef HEIMDAL_UNUSED_ATTRIBUTE\n");
fprintf(f, "#if __has_extension(unused) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
fprintf(f, "#define HEIMDAL_UNUSED_ATTRIBUTE __attribute__((unused))\n");
fprintf(f, "#define HEIMDAL_UNUSED_ATTRIBUTE __attribute__ ((__unused__))\n");
fprintf(f, "#else\n");
fprintf(f, "#define HEIMDAL_UNUSED_ATTRIBUTE\n");
fprintf(f, "#endif\n");
fprintf(f, "#endif\n\n");

fprintf(f, "#ifndef HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE\n");
fprintf(f, "#if __has_extension(warn_unused_result) || KRB5TYPES_REQUIRE_GNUC(3,3,0)\n");
fprintf(f, "#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__((warn_unused_result))\n");
fprintf(f, "#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__ ((__warn_unused_result__))\n");
fprintf(f, "#else\n");
fprintf(f, "#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE\n");
fprintf(f, "#endif\n");
Expand Down
10 changes: 5 additions & 5 deletions include/krb5-types.cross
Expand Up @@ -24,7 +24,7 @@ typedef ssize_t krb5_ssize_t;

#ifndef HEIMDAL_DEPRECATED
#if __has_extension(deprecated) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
#define HEIMDAL_DEPRECATED __attribute__((deprecated))
#define HEIMDAL_DEPRECATED __attribute__ ((__deprecated__))
#elif defined(_MSC_VER) && (_MSC_VER>1200)
#define HEIMDAL_DEPRECATED __declspec(deprecated)
#else
Expand All @@ -34,31 +34,31 @@ typedef ssize_t krb5_ssize_t;

#ifndef HEIMDAL_PRINTF_ATTRIBUTE
#if __has_extension(format) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
#define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__((format x))
#define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__ ((__format__ x))
#else
#define HEIMDAL_PRINTF_ATTRIBUTE(x)
#endif
#endif

#ifndef HEIMDAL_NORETURN_ATTRIBUTE
#if __has_extension(noreturn) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
#define HEIMDAL_NORETURN_ATTRIBUTE __attribute__((noreturn))
#define HEIMDAL_NORETURN_ATTRIBUTE __attribute__ ((__noreturn__))
#else
#define HEIMDAL_NORETURN_ATTRIBUTE
#endif
#endif

#ifndef HEIMDAL_UNUSED_ATTRIBUTE
#if __has_extension(unused) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
#define HEIMDAL_UNUSED_ATTRIBUTE __attribute__((unused))
#define HEIMDAL_UNUSED_ATTRIBUTE __attribute__ ((__unused__))
#else
#define HEIMDAL_UNUSED_ATTRIBUTE
#endif
#endif

#ifndef HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE
#if __has_extension(__warn_unused_result__) || KRB5TYPES_REQUIRE_GNUC(3,3,0)
#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__((__warn_unused_result__))
#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__ ((__warn_unused_result__))
#endif
#endif

Expand Down
6 changes: 3 additions & 3 deletions lib/asn1/gen_template.c
Expand Up @@ -260,13 +260,13 @@ struct tlist {

ASN1_TAILQ_HEAD(tlisthead, tlist);

static void tlist_header(struct tlist *, const char *, ...) __attribute__((__format__(__printf__, 2, 3)));
static void tlist_header(struct tlist *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
static struct template *
add_line(struct templatehead *, const char *, ...) __attribute__((__format__(__printf__, 2, 3)));
add_line(struct templatehead *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
static int tlist_cmp(const struct tlist *, const struct tlist *);

static void add_line_pointer(struct templatehead *, const char *, const char *, const char *, ...)
__attribute__((__format__(__printf__, 4, 5)));
__attribute__ ((__format__ (__printf__, 4, 5)));


static struct tlisthead tlistmaster = ASN1_TAILQ_HEAD_INITIALIZER(tlistmaster);
Expand Down
10 changes: 5 additions & 5 deletions lib/base/heimbase.h
Expand Up @@ -114,12 +114,12 @@ heim_base_once_f(heim_base_once_t *, void *, void (*)(void *));
void
heim_abort(const char *fmt, ...)
HEIMDAL_NORETURN_ATTRIBUTE
HEIMDAL_PRINTF_ATTRIBUTE((printf, 1, 2));
HEIMDAL_PRINTF_ATTRIBUTE((__printf__, 1, 2));

void
heim_abortv(const char *fmt, va_list ap)
HEIMDAL_NORETURN_ATTRIBUTE
HEIMDAL_PRINTF_ATTRIBUTE((printf, 1, 0));
HEIMDAL_PRINTF_ATTRIBUTE((__printf__, 1, 0));

#define heim_assert(e,t) \
(heim_builtin_expect(!(e), 0) ? heim_abort(t ":" #e) : (void)0)
Expand Down Expand Up @@ -220,13 +220,13 @@ typedef struct heim_error * heim_error_t;
heim_error_t heim_error_create_enomem(void);

heim_error_t heim_error_create(int, const char *, ...)
HEIMDAL_PRINTF_ATTRIBUTE((printf, 2, 3));
HEIMDAL_PRINTF_ATTRIBUTE((__printf__, 2, 3));

void heim_error_create_opt(heim_error_t *error, int error_code, const char *fmt, ...)
HEIMDAL_PRINTF_ATTRIBUTE((printf, 3, 4));
HEIMDAL_PRINTF_ATTRIBUTE((__printf__, 3, 4));

heim_error_t heim_error_createv(int, const char *, va_list)
HEIMDAL_PRINTF_ATTRIBUTE((printf, 2, 0));
HEIMDAL_PRINTF_ATTRIBUTE((__printf__, 2, 0));

heim_string_t heim_error_copy_string(heim_error_t);
int heim_error_get_code(heim_error_t);
Expand Down
2 changes: 1 addition & 1 deletion lib/com_err/com_err.c
Expand Up @@ -70,7 +70,7 @@ init_error_table(const char **msgs, long base, int count)

static void KRB5_CALLCONV
default_proc (const char *whoami, long code, const char *fmt, va_list args)
__attribute__((__format__(__printf__, 3, 0)));
__attribute__ ((__format__ (__printf__, 3, 0)));

static void KRB5_CALLCONV
default_proc (const char *whoami, long code, const char *fmt, va_list args)
Expand Down
4 changes: 2 additions & 2 deletions lib/com_err/com_err.h
Expand Up @@ -55,11 +55,11 @@ init_error_table (const char**, long, int);

KRB5_LIB_FUNCTION void KRB5_LIB_CALL
com_err_va (const char *, long, const char *, va_list)
__attribute__((format(printf, 3, 0)));
__attribute__ ((__format__ (__printf__, 3, 0)));

KRB5_LIB_FUNCTION void KRB5_LIB_CALL
com_err (const char *, long, const char *, ...)
__attribute__((format(printf, 3, 4)));
__attribute__ ((__format__ (__printf__, 3, 4)));

KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
set_com_err_hook (errf);
Expand Down
2 changes: 1 addition & 1 deletion lib/com_err/lex.h
Expand Up @@ -34,6 +34,6 @@
/* $Id$ */

void _lex_error_message (const char *, ...)
__attribute__ ((format (printf, 1, 2)));
__attribute__ ((__format__ (__printf__, 1, 2)));

int yylex(void);
2 changes: 1 addition & 1 deletion lib/hx509/cert.c
Expand Up @@ -3404,7 +3404,7 @@ hx509_cert_binary(hx509_context context, hx509_cert c, heim_octet_string *os)

void
_hx509_abort(const char *fmt, ...)
__attribute__ ((noreturn, format (printf, 1, 2)))
__attribute__ ((__noreturn__, __format__ (__printf__, 1, 2)))
{
va_list ap;
va_start(ap, fmt);
Expand Down
2 changes: 1 addition & 1 deletion lib/kadm5/ipropd_slave.c
Expand Up @@ -592,7 +592,7 @@ static void
slave_status(krb5_context context,
const char *file,
const char *status, ...)
__attribute__ ((format (printf, 3, 4)));
__attribute__ ((__format__ (__printf__, 3, 4)));


static void
Expand Down
2 changes: 1 addition & 1 deletion lib/krb5/changepw.c
Expand Up @@ -40,7 +40,7 @@
static void
str2data (krb5_data *d,
const char *fmt,
...) __attribute__ ((format (printf, 2, 3)));
...) __attribute__ ((__format__ (__printf__, 2, 3)));

static void
str2data (krb5_data *d,
Expand Down
4 changes: 2 additions & 2 deletions lib/krb5/deprecated.c
Expand Up @@ -470,7 +470,7 @@ krb5_free_error_string(krb5_context context, char *str)

KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_set_error_string(krb5_context context, const char *fmt, ...)
__attribute__((format (printf, 2, 3)))
__attribute__ ((__format__ (__printf__, 2, 3)))
KRB5_DEPRECATED_FUNCTION("Use X instead")
{
va_list ap;
Expand Down Expand Up @@ -498,7 +498,7 @@ krb5_set_error_string(krb5_context context, const char *fmt, ...)

KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_vset_error_string(krb5_context context, const char *fmt, va_list args)
__attribute__ ((format (printf, 2, 0)))
__attribute__ ((__format__ (__printf__, 2, 0)))
KRB5_DEPRECATED_FUNCTION("Use X instead")
{
krb5_vset_error_message(context, 0, fmt, args);
Expand Down
8 changes: 4 additions & 4 deletions lib/krb5/error_string.c
Expand Up @@ -72,7 +72,7 @@ krb5_clear_error_message(krb5_context context)
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_set_error_message(krb5_context context, krb5_error_code ret,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)))
__attribute__ ((__format__ (__printf__, 3, 4)))
{
va_list ap;

Expand All @@ -98,7 +98,7 @@ krb5_set_error_message(krb5_context context, krb5_error_code ret,
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_vset_error_message (krb5_context context, krb5_error_code ret,
const char *fmt, va_list args)
__attribute__ ((format (printf, 3, 0)))
__attribute__ ((__format__ (__printf__, 3, 0)))
{
int r;

Expand Down Expand Up @@ -136,7 +136,7 @@ krb5_vset_error_message (krb5_context context, krb5_error_code ret,
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_prepend_error_message(krb5_context context, krb5_error_code ret,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)))
__attribute__ ((__format__ (__printf__, 3, 4)))
{
va_list ap;

Expand All @@ -161,7 +161,7 @@ krb5_prepend_error_message(krb5_context context, krb5_error_code ret,
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_vprepend_error_message(krb5_context context, krb5_error_code ret,
const char *fmt, va_list args)
__attribute__ ((format (printf, 3, 0)))
__attribute__ ((__format__ (__printf__, 3, 0)))
{
char *str = NULL, *str2 = NULL;

Expand Down
10 changes: 5 additions & 5 deletions lib/krb5/log.c
Expand Up @@ -411,7 +411,7 @@ krb5_vlog_msg(krb5_context context,
int level,
const char *fmt,
va_list ap)
__attribute__((format (printf, 5, 0)))
__attribute__ ((__format__ (__printf__, 5, 0)))
{

char *msg = NULL;
Expand Down Expand Up @@ -449,7 +449,7 @@ krb5_vlog(krb5_context context,
int level,
const char *fmt,
va_list ap)
__attribute__((format (printf, 4, 0)))
__attribute__ ((__format__ (__printf__, 4, 0)))
{
return krb5_vlog_msg(context, fac, NULL, level, fmt, ap);
}
Expand All @@ -461,7 +461,7 @@ krb5_log_msg(krb5_context context,
char **reply,
const char *fmt,
...)
__attribute__((format (printf, 5, 6)))
__attribute__ ((__format__ (__printf__, 5, 6)))
{
va_list ap;
krb5_error_code ret;
Expand All @@ -479,7 +479,7 @@ krb5_log(krb5_context context,
int level,
const char *fmt,
...)
__attribute__((format (printf, 4, 5)))
__attribute__ ((__format__ (__printf__, 4, 5)))
{
va_list ap;
krb5_error_code ret;
Expand All @@ -495,7 +495,7 @@ _krb5_debug(krb5_context context,
int level,
const char *fmt,
...)
__attribute__((format (printf, 3, 4)))
__attribute__ ((__format__ (__printf__, 3, 4)))
{
va_list ap;

Expand Down
2 changes: 1 addition & 1 deletion lib/krb5/pkinit.c
Expand Up @@ -64,7 +64,7 @@ pk_copy_error(krb5_context context,
int hxret,
const char *fmt,
...)
__attribute__ ((format (printf, 4, 5)));
__attribute__ ((__format__ (__printf__, 4, 5)));

/*
*
Expand Down
2 changes: 1 addition & 1 deletion lib/krb5/send_to_kdc.c
Expand Up @@ -308,7 +308,7 @@ struct host {

static void
debug_host(krb5_context context, int level, struct host *host, const char *fmt, ...)
__attribute__((__format__(__printf__, 4, 5)));
__attribute__ ((__format__ (__printf__, 4, 5)));

static void
debug_host(krb5_context context, int level, struct host *host, const char *fmt, ...)
Expand Down

0 comments on commit c9fc77d

Please sign in to comment.