As it turns out, I must use the Solaris Studio compiler to take advantage
of OpenMP on Solaris. This compiler is much more picky in terms of not
allowing certain non-standard constructs.

Here are the problems I've had:

*Enum values must be a long or unsigned long*

In SystemLimits.hh, LARGE_INT and SMALL_INT are declared as type long long
(with the LL suffix). This is actually not allowed.

I would like to suggest using a namespace and constant variables instead.
(if this is done in other cases as well, this would get rid of all the
warnings the compiler emits when assigning a value to an enum that has not
been previously declared).

*Zero-size arrays are not allowed*

In CDR_string.hh, the *dim* member is declared of size 0. This is allowed
by GCC as an extension, but is non-standard. There is an flag that enables
this extension in the Solaris compiler too, but it may be a good idea to
remove this altogether if possible.

If not, the Solaris Studio flag that is needed is: *-features=zla*

The same thing happens in ValueHistory.cc when value history is disabled
(since VALUEHISTORY_SIZE becomes 0).

*C++ does not support non-constant array sizes*

Declaring an array with a size computed at runtime is not actually allowed
(it's supported in modern C, and also supported in C++ as an extension).

The solution is to use alloca() instead. I.e, change the following:

int foo[bar];


to:

int *foo = (int *)alloca(sizeof(int) * bar);


This happens at:

   - APmain.cc:290
   - AP210.cc:151 and 192
   - Archive.cc:318
   - LibPaths.cc:74 and 81
   - PrimitiveFunction.cc:2285, 2329 and 2940
   - QuadFunction.cc:1465
   - Quad_SVx.cc:268
   - SkalarFunction.cc:505
   - Symbol.cc:205 and 764
   - SystemVariable.cc:553


*The option -g2 is illegal, in src/APs/Makefile*

I'm not sure what this option does even in GCC, but Solaris Studio does not
accept it.

*Overloading ambiguity for maths functions*

The following errors are fixed by casting the inner argument to double:

"IntCell.cc", line 222: Error: Overloading ambiguity between
"std::exp(double)" and "std::exp(float)".
"IntCell.cc", line 234: Error: Overloading ambiguity between
"std::log(double)" and "std::log(float)".
"IntCell.cc", line 234: Error: Overloading ambiguity between
"std::log(double)" and "std::log(float)".
"IntCell.cc", line 230: Error: Overloading ambiguity between
"std::log(double)" and "std::log(float)".
"IntCell.cc", line 234: Error: Overloading ambiguity between
"std::log(double)" and "std::log(float)".


*The include file <locale.h> needs to be included to access the LC_ symbols*

This file needs to be included from SystemVariable.cc

*munmap() does not follow POSIX*

By default, Solaris expects the first argument to munmap() to be a
char *as opposed to void
*. This is non-standard, but standard behaviour can be achieved by setting
the #define _XPG4_2

However... Doing this causes some other issues so it might just be best to
#ifdef that thing and cast the argument to char * on Solaris.

Regards,
Elias

Reply via email to