From b3bfac3f16c320d9c5f56f54b048606872d0a8fd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:10 -0500 Subject: [PATCH] add EPICS_ALWAYS_INLINE --- .../osi/compiler/clang/compilerSpecific.h | 6 +++ .../osi/compiler/default/compilerSpecific.h | 8 ++++ .../osi/compiler/gcc/compilerSpecific.h | 6 +++ .../osi/compiler/msvc/compilerSpecific.h | 6 +++ .../osi/compiler/solStudio/compilerSpecific.h | 43 +++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 src/libCom/osi/compiler/solStudio/compilerSpecific.h diff --git a/src/libCom/osi/compiler/clang/compilerSpecific.h b/src/libCom/osi/compiler/clang/compilerSpecific.h index 482ee513e..9871fcf7d 100644 --- a/src/libCom/osi/compiler/clang/compilerSpecific.h +++ b/src/libCom/osi/compiler/clang/compilerSpecific.h @@ -20,6 +20,12 @@ # error compiler/clang/compilerSpecific.h is only for use with the clang compiler #endif +#if __has_attribute(always_inline) +#define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline)) +#else +#define EPICS_ALWAYS_INLINE __inline__ +#endif + #ifdef __cplusplus /* diff --git a/src/libCom/osi/compiler/default/compilerSpecific.h b/src/libCom/osi/compiler/default/compilerSpecific.h index f2a3f8c36..8af1727c5 100644 --- a/src/libCom/osi/compiler/default/compilerSpecific.h +++ b/src/libCom/osi/compiler/default/compilerSpecific.h @@ -15,6 +15,14 @@ #ifndef compilerSpecific_h #define compilerSpecific_h + +/* The 'inline' key work, possibily with compiler + * dependent flags to force inlineing where it would + * otherwise not be done. + * + * Warning: Second guessing the compiler may result in larger code size + */ +#define EPICS_ALWAYS_INLINE inline #ifdef __cplusplus diff --git a/src/libCom/osi/compiler/gcc/compilerSpecific.h b/src/libCom/osi/compiler/gcc/compilerSpecific.h index 6696c7a89..ca46a9348 100644 --- a/src/libCom/osi/compiler/gcc/compilerSpecific.h +++ b/src/libCom/osi/compiler/gcc/compilerSpecific.h @@ -23,6 +23,12 @@ #ifdef __clang__ # error compiler/gcc/compilerSpecific.h is not for use with the clang compiler #endif + +#if __GNUC__ > 2 +# define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline)) +#else +# define EPICS_ALWAYS_INLINE __inline__ +#endif #ifdef __cplusplus diff --git a/src/libCom/osi/compiler/msvc/compilerSpecific.h b/src/libCom/osi/compiler/msvc/compilerSpecific.h index 587d534c7..49cf266ae 100644 --- a/src/libCom/osi/compiler/msvc/compilerSpecific.h +++ b/src/libCom/osi/compiler/msvc/compilerSpecific.h @@ -20,6 +20,12 @@ # error compiler/msvc/compilerSpecific.h is only for use with the Microsoft compiler #endif +#if _MSC_VER >= 1200 +#define EPICS_ALWAYS_INLINE __forceinline +#else +#define EPICS_ALWAYS_INLINE __inline +#endif + #ifdef __cplusplus /* diff --git a/src/libCom/osi/compiler/solStudio/compilerSpecific.h b/src/libCom/osi/compiler/solStudio/compilerSpecific.h new file mode 100644 index 000000000..2bdcec64d --- /dev/null +++ b/src/libCom/osi/compiler/solStudio/compilerSpecific.h @@ -0,0 +1,43 @@ +/*************************************************************************\ +* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* + * Author: + * Jeffrey O. Hill + * johill@lanl.gov + */ + +#ifndef compilerSpecific_h +#define compilerSpecific_h + +#ifndef __SUNPRO_C +# error Not Solaris Studio +#endif + +#if __SUNPRO_C<0x590 +# define EPICS_ALWAYS_INLINE inline +#else +# define EPICS_ALWAYS_INLINE inline __attribute__((always_inline)) +#endif + +#ifdef __cplusplus + +/* + * CXX_PLACEMENT_DELETE - defined if compiler supports placement delete + * CXX_THROW_SPECIFICATION - defined if compiler supports throw specification + * + * (our default guess is that the compiler implements the C++ 97 standard) + */ +#define CXX_THROW_SPECIFICATION +#define CXX_PLACEMENT_DELETE + +#endif /* __cplusplus */ + + +#endif /* ifndef compilerSpecific_h */