From 2def6a3d805671fe33bcca4da3e10c43f0652694 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 31 Aug 2011 17:35:18 -0500 Subject: [PATCH] Move default macros to compilerDependencies.h Added check in gcc-specific header to error if __clang__ defined Some versions of clang don't support __has_attribute() --- .../osi/compiler/borland/compilerSpecific.h | 10 ------- .../osi/compiler/clang/compilerSpecific.h | 28 ++++++------------- .../osi/compiler/default/compilerSpecific.h | 12 -------- .../osi/compiler/gcc/compilerSpecific.h | 8 ++++-- .../osi/compiler/msvc/compilerSpecific.h | 10 ------- src/libCom/osi/compilerDependencies.h | 17 ++++++++++- 6 files changed, 30 insertions(+), 55 deletions(-) diff --git a/src/libCom/osi/compiler/borland/compilerSpecific.h b/src/libCom/osi/compiler/borland/compilerSpecific.h index 9a86e1aae..9251bfe29 100644 --- a/src/libCom/osi/compiler/borland/compilerSpecific.h +++ b/src/libCom/osi/compiler/borland/compilerSpecific.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. @@ -42,14 +41,5 @@ #endif /* __cplusplus */ -/* - * Enable format-string checking if possible - */ -#define EPICS_PRINTF_STYLE(f,a) - -/* - * Deprecation marker - */ -#define EPICS_DEPRECATED #endif /* ifndef compilerSpecific_h */ diff --git a/src/libCom/osi/compiler/clang/compilerSpecific.h b/src/libCom/osi/compiler/clang/compilerSpecific.h index 881c30f42..9c6b237c5 100644 --- a/src/libCom/osi/compiler/clang/compilerSpecific.h +++ b/src/libCom/osi/compiler/clang/compilerSpecific.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. @@ -21,12 +20,6 @@ # error compiler/clang/compilerSpecific.h is only for use with the clang compiler #endif -/* - * WARNING: the current state of this file is only based on reading clang manuals - * and has not actually been tested with the compiler - */ -#pragma warning compiler/clang/compilerSpecific.h is based on reading the manual, but hasnt been tested with the clang compiler - #ifdef __cplusplus /* @@ -39,21 +32,18 @@ #endif /* __cplusplus */ /* - * Enable format-string checking if possible + * __has_attribute() is not supported on all versions of clang yet */ -#if __has_attribute(format) -# define EPICS_PRINTF_STYLE(f,a) __attribute__((format(__printf__,f,a))) -#else -# define EPICS_PRINTF_STYLE -#endif /* - * Deprecation marker if possible + * Enable format-string checking */ -#if __has_attribute(deprecated) -# define EPICS_DEPRECATED __attribute__((deprecated)) -#else -# define EPICS_DEPRECATED -#endif +#define EPICS_PRINTF_STYLE(f,a) __attribute__((format(__printf__,f,a))) + +/* + * Deprecation marker + */ +#define EPICS_DEPRECATED __attribute__((deprecated)) + #endif /* ifndef compilerSpecific_h */ diff --git a/src/libCom/osi/compiler/default/compilerSpecific.h b/src/libCom/osi/compiler/default/compilerSpecific.h index da2a21acc..f2a3f8c36 100644 --- a/src/libCom/osi/compiler/default/compilerSpecific.h +++ b/src/libCom/osi/compiler/default/compilerSpecific.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. @@ -30,16 +29,5 @@ #endif /* __cplusplus */ -/* - * Enable format-string checking if possible - * (our default guess is that the compiler doesnt implement non-standard extensions) - */ -#define EPICS_PRINTF_STYLE(f,a) - -/* - * Deprecation marker - * (our default guess is that the compiler doesnt implement non-standard extensions) - */ -#define EPICS_DEPRECATED #endif /* ifndef compilerSpecific_h */ diff --git a/src/libCom/osi/compiler/gcc/compilerSpecific.h b/src/libCom/osi/compiler/gcc/compilerSpecific.h index 3dc505c29..efd17e4b2 100644 --- a/src/libCom/osi/compiler/gcc/compilerSpecific.h +++ b/src/libCom/osi/compiler/gcc/compilerSpecific.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. @@ -20,6 +19,10 @@ #ifndef __GNUC__ # error compiler/gcc/compilerSpecific.h is only for use with the gnu compiler #endif + +#ifdef __clang__ +# error compiler/gcc/compilerSpecific.h is not for use with the clang compiler +#endif #ifdef __cplusplus @@ -55,8 +58,7 @@ */ #if (__GNUC__ > 2) # define EPICS_DEPRECATED __attribute__((deprecated)) -#else -# define EPICS_DEPRECATED #endif + #endif /* ifndef compilerSpecific_h */ diff --git a/src/libCom/osi/compiler/msvc/compilerSpecific.h b/src/libCom/osi/compiler/msvc/compilerSpecific.h index 64ebf915f..587d534c7 100644 --- a/src/libCom/osi/compiler/msvc/compilerSpecific.h +++ b/src/libCom/osi/compiler/msvc/compilerSpecific.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. @@ -44,14 +43,5 @@ #endif /* __cplusplus */ -/* - * Enable format-string checking if possible - */ -#define EPICS_PRINTF_STYLE(f,a) - -/* - * Deprecation marker - */ -#define EPICS_DEPRECATED #endif /* ifndef compilerSpecific_h */ diff --git a/src/libCom/osi/compilerDependencies.h b/src/libCom/osi/compilerDependencies.h index 7f2acc699..c91133996 100644 --- a/src/libCom/osi/compilerDependencies.h +++ b/src/libCom/osi/compilerDependencies.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. @@ -44,4 +43,20 @@ #endif /* __cplusplus */ + +#ifndef EPICS_PRINTF_STYLE +/* + * No format-string checking + */ +# define EPICS_PRINTF_STYLE(f,a) +#endif + +#ifndef EPICS_DEPRECATED +/* + * No deprecation markers + */ +#define EPICS_DEPRECATED +#endif + + #endif /* ifndef compilerDependencies_h */