Created attachment 25294 [details] bzip2 compressed preprocessed source for common/semaphore.cc Current gcc trunk produces a compile time error for common/semaphore.cc in xplor-nih 2.27... g++-fsf-4.7 -c semaphore.cc -O3 -ffast-math -funroll-loops -g -fpermissive -DX_MMAP_FLAGS=0 -DFORTRAN_INIT -fno-common -DDARWIN -D_REENTRANT -DNDEBUG -I/Users/howarth/xplor-nih-2.27/common/ -I/Users/howarth/xplor-nih-2.27/arch/Darwin_11_x86_64/include -I/Users/howarth/xplor-nih-2.27/CDSlib -I/Users/howarth/xplor-nih-2.27/intVar -I/Users/howarth/xplor-nih-2.27/pcre -DCPLUSPLUS -DUSE_CDS_NAMESPACE -I/Users/howarth/xplor-nih-2.27/common/ -I/Users/howarth/xplor-nih-2.27/arch/Darwin_11_x86_64/include semaphore.cc: In constructor ‘CDS::Semaphore::Semaphore(bool)’: semaphore.cc:111:30: error: ‘getpid’ was not declared in this scope semaphore.cc: In destructor ‘CDS::Semaphore::~Semaphore()’: semaphore.cc:124:36: error: ‘getpid’ was not declared in this scope semaphore.cc:126:9: warning: deleting ‘void*’ is undefined [enabled by default] which doesn't occur with gcc-4_6-branch... [MacPro:~/xplor-nih-2.27/common/bin.Darwin_11_x86_64] howarth% g++-fsf-4.6 -c semaphore.cc -O3 -ffast-math -funroll-loops -g -fpermissive -DX_MMAP_FLAGS=0 -DFORTRAN_INIT -fno-common -DDARWIN -D_REENTRANT -DNDEBUG -I/Users/howarth/xplor-nih-2.27/common/ -I/Users/howarth/xplor-nih-2.27/arch/Darwin_11_x86_64/include -I/Users/howarth/xplor-nih-2.27/CDSlib -I/Users/howarth/xplor-nih-2.27/intVar -I/Users/howarth/xplor-nih-2.27/pcre -DCPLUSPLUS -DUSE_CDS_NAMESPACE -I/Users/howarth/xplor-nih-2.27/common/ -I/Users/howarth/xplor-nih-2.27/arch/Darwin_11_x86_64/include semaphore.cc: In destructor ‘CDS::Semaphore::~Semaphore()’: semaphore.cc:126:9: warning: deleting ‘void*’ is undefined [enabled by default]
Attached bzip2 compressed preprocessed source for common/semaphore.cc reproduces this issue... [MacPro:~/xplor-nih-2.27/common/bin.Darwin_11_x86_64] howarth% g++-fsf-4.7 -c semaphore.ii -O3 -ffast-math -funroll-loops -g -fpermissive -DX_MMAP_FLAGS=0 -DFORTRAN_INIT -fno-common -DDARWIN -D_REENTRANT -DNDEBUGsemaphore.cc: In constructor ‘CDS::Semaphore::Semaphore(bool)’:semaphore.cc:111:30: error: ‘getpid’ was not declared in this scope semaphore.cc: In destructor ‘CDS::Semaphore::~Semaphore()’: semaphore.cc:124:36: error: ‘getpid’ was not declared in this scope semaphore.cc:126:9: warning: deleting ‘void*’ is undefined [enabled by default]
Note that -fpermissive doesn't eliminate the regression.
This is expected you are not including unistd.h in your source which is required if you want to use getpid. It was a bug before GCC 4.7 that some of the C++ headers included that header file.
As documented at http://gcc.gnu.org/gcc-4.7/changes.html "Avoid polluting the global namespace by inclusion of <unistd.h>."