Merged compiler-specific include files branch.

This commit is contained in:
Andrew Johnson
2011-09-01 11:42:37 -05:00
17 changed files with 351 additions and 126 deletions
-104
View File
@@ -1,104 +0,0 @@
/*************************************************************************\
* 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 compilerDependencies_h
#define compilerDependencies_h
/*
* This is an attempt to move all tests identifying what features a
* compiler supports into one file.
*
* Since this is a compiler, and not os dependent, issue then ifdefs
* are used. The ifdefs allow us to make the default assumption that
* standards incompliance issues will be fixed by future compiler
* releases.
*/
#ifdef __cplusplus
/*
* CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
* CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
*/
#if defined ( _MSC_VER )
# if _MSC_VER >= 1200 /* visual studio 6.0 or later */
# define CXX_PLACEMENT_DELETE
# endif
# if _MSC_VER > 1300 /* some release after visual studio 7 we hope */
# define CXX_THROW_SPECIFICATION
# endif
#elif defined ( __HP_aCC )
# if _HP_aCC > 33300
# define CXX_PLACEMENT_DELETE
# endif
# define CXX_THROW_SPECIFICATION
#elif defined ( __BORLANDC__ )
# if __BORLANDC__ >= 0x600
# define CXX_PLACEMENT_DELETE
# endif
# define CXX_THROW_SPECIFICATION
#elif defined ( __GNUC__ )
# if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
# define CXX_THROW_SPECIFICATION
# endif
# if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 )
# define CXX_PLACEMENT_DELETE
# endif
#else
# define CXX_PLACEMENT_DELETE
# define CXX_THROW_SPECIFICATION
#endif
/*
* usage: void func () epicsThrows (( std::bad_alloc, std::logic_error ))
*/
#if defined ( CXX_THROW_SPECIFICATION )
# define epicsThrows(X) throw X
#else
# define epicsThrows(X)
#endif
/*
* usage: epicsPlacementDeleteOperator (( void *, myMemoryManager & ))
*/
#if defined ( CXX_PLACEMENT_DELETE )
# define epicsPlacementDeleteOperator(X) void operator delete X;
#else
# define epicsPlacementDeleteOperator(X)
#endif
#endif /* __cplusplus */
/*
* Enable format-string checking if possible
*/
#ifdef __GNUC__
# define EPICS_PRINTF_STYLE(f,a) __attribute__((format(__printf__,f,a)))
#else
# define EPICS_PRINTF_STYLE(f,a)
#endif
/*
* Deprecation marker
*/
#if defined( __GNUC__ ) && (__GNUC__ > 2)
# define EPICS_DEPRECATED __attribute__((deprecated))
#else
# define EPICS_DEPRECATED
#endif
#endif /* ifndef compilerDependencies_h */
+4
View File
@@ -8,6 +8,10 @@
# This is a Makefile fragment, see src/libCom/Makefile.
SRC_DIRS += $(LIBCOM)/osi
INC += compilerDependencies.h
INC += compilerSpecific.h
INC += osiFileName.h
INC += osiSock.h
INC += osdSock.h
@@ -0,0 +1,45 @@
/*************************************************************************\
* 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 __BORLANDC__
# error compiler/borland/compilerSpecific.h is only for use with the Borland compiler
#endif
#ifdef __cplusplus
/*
* in general we dont like ifdefs but they do allow us to check the
* compiler version and make the optimistic assumption that
* standards incompliance issues will be fixed by future compiler
* releases
*/
/*
* CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
* CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
*/
#if __BORLANDC__ >= 0x600
# define CXX_PLACEMENT_DELETE
#endif
#define CXX_THROW_SPECIFICATION
#endif /* __cplusplus */
#endif /* ifndef compilerSpecific_h */
@@ -0,0 +1,49 @@
/*************************************************************************\
* 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 __clang__
# error compiler/clang/compilerSpecific.h is only for use with the clang compiler
#endif
#ifdef __cplusplus
/*
* CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
* CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
*/
#define CXX_PLACEMENT_DELETE
#define CXX_THROW_SPECIFICATION
#endif /* __cplusplus */
/*
* __has_attribute() is not supported on all versions of clang yet
*/
/*
* Enable format-string checking
*/
#define EPICS_PRINTF_STYLE(f,a) __attribute__((format(__printf__,f,a)))
/*
* Deprecation marker
*/
#define EPICS_DEPRECATED __attribute__((deprecated))
#endif /* ifndef compilerSpecific_h */
@@ -0,0 +1,33 @@
/*************************************************************************\
* 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
#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 */
@@ -0,0 +1,64 @@
/*************************************************************************\
* 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 __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
/*
* in general we dont like ifdefs but they do allow us to check the
* compiler version and make the optimistic assumption that
* standards incompliance issues will be fixed by future compiler
* releases
*/
/*
* CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
* CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
*/
#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
# define CXX_THROW_SPECIFICATION
#endif
#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 )
# define CXX_PLACEMENT_DELETE
#endif
#endif /* __cplusplus */
/*
* Enable format-string checking if possible
*/
#define EPICS_PRINTF_STYLE(f,a) __attribute__((format(__printf__,f,a)))
/*
* Deprecation marker if possible
*/
#if (__GNUC__ > 2)
# define EPICS_DEPRECATED __attribute__((deprecated))
#endif
#endif /* ifndef compilerSpecific_h */
@@ -0,0 +1,47 @@
/*************************************************************************\
* 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 _MSC_VER
# error compiler/msvc/compilerSpecific.h is only for use with the Microsoft compiler
#endif
#ifdef __cplusplus
/*
* in general we dont like ifdefs but they do allow us to check the
* compiler version and make the optimistic assumption that
* standards incompliance issues will be fixed by future compiler
* releases
*/
/*
* CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
* CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
*/
#if _MSC_VER >= 1200 /* visual studio 6.0 or later */
# define CXX_PLACEMENT_DELETE
#endif
#if _MSC_VER > 1300 /* some release after visual studio 7 we hope */
# define CXX_THROW_SPECIFICATION
#endif
#endif /* __cplusplus */
#endif /* ifndef compilerSpecific_h */
+62
View File
@@ -0,0 +1,62 @@
/*************************************************************************\
* 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 compilerDependencies_h
#define compilerDependencies_h
#include "compilerSpecific.h"
#ifdef __cplusplus
/*
* usage: void func () epicsThrows (( std::bad_alloc, std::logic_error ))
*
* Note: now a widely accepted concensus (ref Meyers and C++ faq) is that
* one should avoid using throw specifications in C++ code
*/
#if defined ( CXX_THROW_SPECIFICATION )
# define epicsThrows(X) throw X
#else
# define epicsThrows(X)
#endif
/*
* usage: epicsPlacementDeleteOperator (( void *, myMemoryManager & ))
*/
#if defined ( CXX_PLACEMENT_DELETE )
# define epicsPlacementDeleteOperator(X) void operator delete X;
#else
# define epicsPlacementDeleteOperator(X)
#endif
#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 */