Problem 104

Summary: Changes required for KCC non-exceptions compilation
Product: Geant4 Reporter: greenc
Component: globalAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: normal CC: greenc
Priority: P2    
Version: 1.1   
Hardware: All   
OS: All   

Description greenc 2000-06-23 10:25:37 CEST
(From C. Green, CDF, FNAL)

Hi,

The following changes are necessary to enable strict ANSI compilation with the
KCC compiler (v3.3) with exceptions *disabled*:

In source/global/STLInterface/g4rw/defs.h, G4RWTHROW should be redefined to
``abort()'' rather than ``throw a'' in the case that exceptions are disabled
(G4NO_STD_EXCEPTIONS).

Consequently, in source/global/STLInterface/g4rw/tpsrtvec.icc and
source/global/STLInterface/g4rw/tvordvec.icc , the last() functions must be
slightly rewritten to return a value even in the condition branch including the
throw (abort() never returns either, but the compiler can't assume that).

In source/global/STLInterface/g4rw/cstring.icc, strcasecmp() is a non-ANSI
function which is not provided by (eg) GNU glibc v2.1 unless __USE_BSD or
__USE_XOPEN_EXTENDED macros are set (this is not true for strict ANSI compiles).
The solution would be to implement a private member function to compare up-cased
(or down-cased) temporaries of the strings to be compared. Locally we have just
assumed exact comparisons and replaced the call with one to strcmp, but that is
obviously not a viable solution for the release.

source/global/management/src/G4Timer.cc is affected on IRIX 6.2 systems only by
a bug in unistd.h (I think) regarding the vfork function. The following lines
are a sufficient fix for this platform:

#if defined(IRIX6_2)
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED==1)
#define __vfork vfork
#endif
#endif
Comment 1 Gabriele Cosmo 2000-06-27 05:21:59 CEST
Fixed in tag "global-V01-01-05" for source/global.
It will be included in Geant4 2.0 public release.
Thanks for reporting it.