From: Simon Wilkinson Date: Fri, 11 Jun 2010 22:49:34 +0000 (+0100) Subject: Add support for clang compiler attributes X-Git-Tag: openafs-devel-1_5_75~152 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6c645092eeb9c44d45d5ceab264a360eef7f2536 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 --- diff --git a/src/config/stds.h b/src/config/stds.h index fcc1517..eb187b8 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 */