EPICS Home

Experimental Physics and Industrial Control System


 
2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: [Merge] lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base
From: Jeff Hill <[email protected]>
To: [email protected]
Date: Fri, 19 Aug 2011 21:00:29 -0000
Jeff Hill has proposed merging lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base.

Requested reviews:
  EPICS Core Developers (epics-core)

For more details, see:
https://code.launchpad.net/~epics-core/epics-base/3.15-buildCompilerSpecific/+merge/72258


o Upgrade the build system so that we can implement functionality which is compiler specific in a separate file for each compiler. This will avoid accumulating MxN ifdef's where M is the number of OS and N is the number of compilers (worst case). This will make it easier to find code that is compiler specific centralizing all of it under libCom/osi/compiler. That should make it mush easier to port EPICS to run on a new compiler.

o I also re-factored compilerDependencies.h into code that is compiler specific (one libCom/osi/compiler/xxx/compilerDependent.h for each compiler) and code that isn't libCom/osi/compilerDependencies.h (this is a new location and is no longer in libCom/misc). I also merged recent change to R3.15 that prevents use of the gnu deprecated attribute if its early gcc.

Note that we don't want too much in each proposed merge. However, w/o a small code change such as the re-factoring of compilerDependencies.h then its somewhat problematic to test the build system change in the branch.
-- 
https://code.launchpad.net/~epics-core/epics-base/3.15-buildCompilerSpecific/+merge/72258
Your team EPICS Core Developers is requested to review the proposed merge of lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base.
=== modified file 'configure/CONFIG.gnuCommon'
--- configure/CONFIG.gnuCommon	2009-11-25 17:15:47 +0000
+++ configure/CONFIG.gnuCommon	2011-08-19 21:00:26 +0000
@@ -12,6 +12,8 @@
 
 GNU = YES
 
+CMPLR_CLASS = gcc
+
 GNU_BIN = $(GNU_DIR)/bin
 GNU_LIB = $(GNU_DIR)/lib
 

=== modified file 'configure/CONFIG_COMMON'
--- configure/CONFIG_COMMON	2011-08-17 21:36:38 +0000
+++ configure/CONFIG_COMMON	2011-08-19 21:00:26 +0000
@@ -133,11 +133,14 @@
 GENERIC_SRC_DIRS = .. $(SRC_DIRS)
 OS_SRC_DIRS += . $(foreach dir, .. $(SRC_DIRS), \
        $(addprefix $(dir)/, os/$(OS_CLASS) $(POSIX_$(POSIX)) os/default ))
-ALL_SRC_DIRS = $(OS_SRC_DIRS) $(GENERIC_SRC_DIRS)
+CMPLR_SRC_DIRS += . $(foreach dir, .. $(SRC_DIRS), \
+       $(addprefix $(dir)/, compiler/$(CMPLR_CLASS) compiler/default ))
+ALL_SRC_DIRS = $(CMPLR_SRC_DIRS) $(OS_SRC_DIRS) $(GENERIC_SRC_DIRS)
 
 #--------------------------------------------------
 # compile line include directories
 INSTALL_INCLUDES += \
+       -I$(INSTALL_INCLUDE)/compiler/$(CMPLR_CLASS) \
        -I$(INSTALL_INCLUDE)/os/$(OS_CLASS) \
        -I$(INSTALL_INCLUDE)
 SRC_INCLUDES = -I$(COMMON_DIR) $(addprefix -I, $(wildcard $(ALL_SRC_DIRS)))
@@ -379,25 +382,36 @@
 #
 # auto determine the directory paths that things are installed to
 # RULES:
-# 1) found in any one of several os specific area
+# 0) found in any one of several compiler specific paths
+#       => install to $(INSTALL_INCLUDE)/compiler/$(CMPLR_CLASS)
+# 1) not found in (0) and found in any one of several OS specific paths
 #       => install to $(INSTALL_INCLUDE)/os/$(OS_CLASS)
-# 2) not foundin (1) and found in generic area
+# 2) not found in (1) and found in generic paths
 #       => install to $(INSTALL_INCLUDE)
 # 3) not found in (1) or (2) then may be (not yet) computer generated
 #       => install into $(INSTALL_INCLUDE)/os/$(OS_CLASS) and let
 #       build rules work on vpath
 #
 # These rules guarantee that the users include from
-# no more than two directories
+# no more than three directories
 #
 INSTALL_INC += $(foreach inc, $(INC), \
     $(firstword \
+        $(CMPLR_INSTALL_INC) \
         $(OS_INSTALL_INC) \
         $(GENERIC_INSTALL_INC) \
         $(GENERATED_INSTALL_INC) ) )
 INSTALL_INC += $(addprefix $(INSTALL_INCLUDE)/os/$(OS_CLASS)/, $(INC_$(OS_CLASS)) )
 
 #
+# Rule 0
+#
+CMPLR_INSTALL_INC = $(addprefix $(INSTALL_INCLUDE)/compiler/$(CMPLR_CLASS)/, $(INSTALL_INC_jjj) )
+INSTALL_INC_jjj = $(foreach dir, $(CMPLR_SRC_DIRS), $(INSTALL_INC_iii)  )
+INSTALL_INC_iii = $(subst $(dir)/, , $(INSTALL_INC_hhh) )
+INSTALL_INC_hhh = $(wildcard $(addsuffix /$(inc), $(dir)) )
+
+#
 # Rule 1
 #
 OS_INSTALL_INC = $(addprefix $(INSTALL_INCLUDE)/os/$(OS_CLASS)/, $(INSTALL_INC_ggg) )

=== modified file 'configure/RULES_BUILD'
--- configure/RULES_BUILD	2011-08-17 21:36:38 +0000
+++ configure/RULES_BUILD	2011-08-19 21:00:26 +0000
@@ -410,7 +410,11 @@
 	@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
 
 $(INSTALL_INCLUDE)/os/$(OS_CLASS)/% : %
-	$(ECHO) "Installing os dependent include file $@"
+	$(ECHO) "Installing OS dependent include file $@"
+	@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
+	
+$(INSTALL_INCLUDE)/compiler/$(CMPLR_CLASS)/% : %
+	$(ECHO) "Installing compiler dependent include file $@"
 	@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
 
 $(INSTALL_DOC)/%: %

=== modified file 'configure/os/CONFIG.solarisCommon.solarisCommon'
--- configure/os/CONFIG.solarisCommon.solarisCommon	2010-10-05 19:27:37 +0000
+++ configure/os/CONFIG.solarisCommon.solarisCommon	2011-08-19 21:00:26 +0000
@@ -7,6 +7,8 @@
 # Sites may override these definitions in CONFIG_SITE.solaris-sparc.solaris-sparc
 #-------------------------------------------------------
 
+CMPLR_CLASS = solStudio
+
 SPARCWORKS = /opt/SUNWspro
 GNU = NO
 

=== modified file 'configure/os/CONFIG.win32-x86-borland.win32-x86-borland'
--- configure/os/CONFIG.win32-x86-borland.win32-x86-borland	2011-02-16 16:57:20 +0000
+++ configure/os/CONFIG.win32-x86-borland.win32-x86-borland	2011-08-19 21:00:26 +0000
@@ -7,6 +7,8 @@
 # Sites may override these definitions in CONFIG_SITE.win32-x86-borland.win32-x86-borland
 #-------------------------------------------------------
 
+CMPLR_CLASS = borland
+
 # Win32 valid build types and include directory suffixes
 
 VALID_BUILDS = Host Ioc

=== modified file 'configure/os/CONFIG.win32-x86.win32-x86'
--- configure/os/CONFIG.win32-x86.win32-x86	2011-08-17 21:36:38 +0000
+++ configure/os/CONFIG.win32-x86.win32-x86	2011-08-19 21:00:26 +0000
@@ -11,6 +11,8 @@
 
 VALID_BUILDS = Host Ioc
 
+CMPLR_CLASS = msvc
+
 # convert UNIX path to native path
 PATH_FILTER = $(subst /,\\,$(1))
 

=== modified file 'src/libCom/Makefile'
--- src/libCom/Makefile	2010-10-12 16:27:17 +0000
+++ src/libCom/Makefile	2011-08-19 21:00:26 +0000
@@ -136,7 +136,6 @@
 INC += unixFileName.h
 INC += locationException.h
 INC += ipAddrToAsciiAsynchronous.h
-INC += compilerDependencies.h
 INC += epicsUnitTest.h
 INC += testMain.h
 SRCS += aToIPAddr.c
@@ -195,6 +194,8 @@
 INC += devLibVME.h
 INC += devLibVMEImpl.h
 INC += osdVME.h
+INC += compilerDependencies.h
+INC += compilerSpecific.h
 
 SRCS += epicsThread.cpp
 SRCS += epicsMutex.cpp

=== renamed file 'src/libCom/misc/compilerDependencies.h' => 'src/libCom/misc/compilerDependencies.h.THIS'
=== added directory 'src/libCom/osi/compiler'
=== added directory 'src/libCom/osi/compiler/borland'
=== added file 'src/libCom/osi/compiler/borland/compilerSpecific.h'
--- src/libCom/osi/compiler/borland/compilerSpecific.h	1970-01-01 00:00:00 +0000
+++ src/libCom/osi/compiler/borland/compilerSpecific.h	2011-08-19 21:00:26 +0000
@@ -0,0 +1,55 @@
+
+/*************************************************************************\
+* 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
+ * [email protected]
+ */
+
+#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 */
+
+/*
+ * Enable format-string checking if possible
+ */
+#define EPICS_PRINTF_STYLE(f,a)
+
+/*
+ * Deprecation marker
+ */
+#define EPICS_DEPRECATED
+
+#endif  /* ifndef compilerSpecific_h */

=== added directory 'src/libCom/osi/compiler/clang'
=== added file 'src/libCom/osi/compiler/clang/compilerSpecific.h'
--- src/libCom/osi/compiler/clang/compilerSpecific.h	1970-01-01 00:00:00 +0000
+++ src/libCom/osi/compiler/clang/compilerSpecific.h	2011-08-19 21:00:26 +0000
@@ -0,0 +1,59 @@
+
+/*************************************************************************\
+* 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
+ * [email protected]
+ */
+
+#ifndef compilerSpecific_h
+#define compilerSpecific_h
+ 
+#ifndef __clang__
+#   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
+
+/*
+ * 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 */
+
+/*
+ * Enable format-string checking if possible
+ */
+#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
+ */
+#if __has_attribute(deprecated)
+#   define EPICS_DEPRECATED __attribute__((deprecated))
+#else
+#   define EPICS_DEPRECATED
+#endif
+
+#endif  /* ifndef compilerSpecific_h */

=== added directory 'src/libCom/osi/compiler/default'
=== added file 'src/libCom/osi/compiler/default/compilerSpecific.h'
--- src/libCom/osi/compiler/default/compilerSpecific.h	1970-01-01 00:00:00 +0000
+++ src/libCom/osi/compiler/default/compilerSpecific.h	2011-08-19 21:00:26 +0000
@@ -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
+ * [email protected]
+ */
+
+#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 */
+
+/*
+ * 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 */

=== added directory 'src/libCom/osi/compiler/gcc'
=== added file 'src/libCom/osi/compiler/gcc/compilerSpecific.h'
--- src/libCom/osi/compiler/gcc/compilerSpecific.h	1970-01-01 00:00:00 +0000
+++ src/libCom/osi/compiler/gcc/compilerSpecific.h	2011-08-19 21:00:26 +0000
@@ -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
+ * [email protected]
+ */
+
+#ifndef compilerSpecific_h
+#define compilerSpecific_h
+
+#ifndef __GNUC__
+#   error compiler/gcc/compilerSpecific.h is only for use with the gnu 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))
+#else
+#   define EPICS_DEPRECATED
+#endif
+
+#endif  /* ifndef compilerSpecific_h */

=== added directory 'src/libCom/osi/compiler/msvc'
=== added file 'src/libCom/osi/compiler/msvc/compilerSpecific.h'
--- src/libCom/osi/compiler/msvc/compilerSpecific.h	1970-01-01 00:00:00 +0000
+++ src/libCom/osi/compiler/msvc/compilerSpecific.h	2011-08-19 21:00:26 +0000
@@ -0,0 +1,57 @@
+
+/*************************************************************************\
+* 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
+ * [email protected]
+ */
+
+#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 */
+
+/*
+ * Enable format-string checking if possible
+ */
+#define EPICS_PRINTF_STYLE(f,a)
+
+/*
+ * Deprecation marker
+ */
+#define EPICS_DEPRECATED
+
+#endif  /* ifndef compilerSpecific_h */

=== added directory 'src/libCom/osi/compiler/solStudio'
=== added file 'src/libCom/osi/compilerDependencies.h'
--- src/libCom/osi/compilerDependencies.h	1970-01-01 00:00:00 +0000
+++ src/libCom/osi/compilerDependencies.h	2011-08-19 21:00:26 +0000
@@ -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
+ * [email protected]
+ */
+
+#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 */
+
+#endif  /* ifndef compilerDependencies_h */


Replies:
Re: [Merge] lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base Andrew Johnson
Re: [Merge] lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base Jeff Hill
[Merge] lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base noreply

Navigate by Date:
Prev: Re: [Merge] lp:~anj/epics-base/epicsEvent-api into lp:epics-base Andrew Johnson
Next: Re: [Merge] lp:~epics-core/epics-base/epicsR3.15-atomics into lp:epics-base Jeff Hill
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: c++ 0x initialization of local (block scoped) static variables Jeff Hill
Next: Re: [Merge] lp:~epics-core/epics-base/3.15-buildCompilerSpecific into lp:epics-base Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024