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

Richard PALO via RT rt at openssl.org
Mon Nov 23 07:16:22 UTC 2015


Le 22/11/15 17:26, Andy Polyakov via RT a écrit :
> 
> 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.
> 

Not really looking to argue, but I don't believe this to be entirely
true.  That is, gcc 2.95 is certainly not the only compiler available
on SunOS 4... even today SunOS can install packages from, for a perfect
example, pkgsrc which provides gcc{2..5}.

Any gcc3 or higher *always* generates '__sun'. So does clang.
Sun/Solaris Studio do so as well. Compilers for the obsolete BSD-based SunOS also defined __sun (according to http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system)

On the other hand, I believe openssl 1.0 was released somewhere around 2010,
ten years after (love the group:-) the 2.95 release of gcc.  So I wonder which
compiler is really used in practice?

> 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.
> 
> 

Well, I can't speak for the author of the above note on the gcc site,
but to extract a recent quote from a NetBSD and pkgsrc developer: 
"Programs should be written to standards, not gcc extensions."

In the meanwhile there is -std=c99 and more recently -std=c11 that have
been published with the similar strict requirements.

Finally, I would be happy add back the check for 'sun' as well as '__sun'
if deemed necessary.

cheers,
-- 
Richard PALO




More information about the openssl-dev mailing list