[openssl-dev] [openssl.org #4144] patch: Use '__sun' instead of 'sun' for strict ISO conforming, compiler/options

Andy Polyakov via RT rt at openssl.org
Sun Nov 22 16:26:51 UTC 2015


>>> FWIW, the generally accepted and documented platform tests include:
>>>>  #ifdef __sun
>>>>  /* this is SunOS */
>>>>  #endif
>>
>> By the way, was it *actually* tested on SunOS 4? And if so, when and
>> with which compiler? Is it possible that it simply was harmonized at
>> some point with "we have double-underscore everywhere, don't we"
>> rationale, without actual test on SunOS 4? And this way became kind of
>> an urban legend? Well, I'm not actually asserting that I myself have
>> possibility to test something on SunOS 4 now, but I have copy of system
>> headers and see what did gcc 2.95 define...
>>
>>
>>
>>
> Well, I admit I only checked back to gcc3... I did notice the following though:
> https://sourceforge.net/p/predef/wiki/OperatingSystems/
>> #if defined(sun) || defined(__sun)
>> # if defined(__SVR4) || defined(__svr4__)
>> /* Solaris */
>> # else
>> /* SunOS */
>> # endif
>> #endif
> 
> that is, if supporting that far back is indeed a goal,

Irregardless whether or not goal is formulated like *this*, it's
definitely can be formulated at least as "keep even legacy platforms in
mind". I mean it's more about discipline.

> then *both* should be checked. Naturally that should be acceptable to most anybody concerned.

If you want distinguish Solaris, yes. But if you want to distinguish
specifically SunOS 4, 'sun' is guaranteed to do the job. Because
compiler that targets SunOS 4 *has to* have it. Either way, we seem to
agree that *replacing* sun with __sun is not right thing to do in SunOS
4 context. One can argue for sun || __sun, or one can argue in favour of
reverting. My vote goes for latter, because original conditions [in
e_os.h] do work adequately. Well, one can argue that it works
*incidentally*, but in such situation I usually reason that released
software has certain "mass" and one should approach it more
pragmatically. At the very least one shouldn't consider "strict ISO
conformity" in broadest sense, but even answer question how does it
affect platforms in specific supported configurations reflected in
Configure.

As for reference to 'sun' not being defined with -ansi already in 2.95.
At the same time it also says that it's basically counterproductive,
because [once again] system headers require it. One should also keep in
mind that standard compliance is never perfect, especially on older
systems, and you're driven to make trade-offs. Like the one in question.




More information about the openssl-dev mailing list