From 6c645092eeb9c44d45d5ceab264a360eef7f2536 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 11 Jun 2010 23:49:34 +0100 Subject: [PATCH] Add support for clang compiler attributes Rearrange the way that we define compiler attributes so that we can define them for clang, too. Don't assume that clang will support all of the attributes that gcc does, so split them up into separate sections. Change-Id: Ic6233f5c63a07b3ef99a85ae3be9e45e28387127 Reviewed-on: http://gerrit.openafs.org/2135 Reviewed-by: Russ Allbery Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/config/stds.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/config/stds.h b/src/config/stds.h index fcc151796..eb187b82d 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -333,14 +333,18 @@ hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return #define afs_int_to_pointer(i) ((void *) (i)) #endif -#if !defined(__GNUC__) || __GNUC__ < 2 -#define AFS_UNUSED -#define AFS_ATTRIBUTE_FORMAT(style,x,y) -#define AFS_NORETURN -#else +#if defined(__GNUC__) && __GNUC__ > 2 #define AFS_UNUSED __attribute__((unused)) #define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y))) #define AFS_NORETURN __attribute__((__noreturn__)); +#elif defined (__clang__) +#define AFS_UNUSED __attribute__((unused)) +#define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y))) +#define AFS_NORETURN __attribute__((__noreturn__)); +#else +#define AFS_UNUSED +#define AFS_ATTRIBUTE_FORMAT(style,x,y) +#define AFS_NORETURN #endif #endif /* OPENAFS_CONFIG_AFS_STDS_H */ -- 2.39.5