[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
Tue Nov 17 18:33:22 UTC 2015


Le 17/11/15 19:09, Kurt Roeckx via RT a écrit :
> On Tue, Nov 17, 2015 at 05:43:45PM +0000, Richard PALO via RT wrote:
>> I'd like to propose the attached patch to 1.0.2d which avoids problems
>> with strict ISO conforming compiler/options, which do not define 'sun' only
>> '__sun' as usual... such as gcc/clang -std=c99
> 
> I fail to understand how this would cause any problems for you.
> Also, we're not targetting C99, we're still at C89/C90 with some
> extentions.  If a newer standard conflicts we should of course try
> to fix it, but it build just as fine using gnu99 or gnu11 for me.
> 
> 
> Kurt

Straight from Oracle concerning Solaris:
>  
> #ifdef __sun
>        Sun compiler
> #endif
> #ifdef __SUNPRO_C
>        Sun C compiler /* __SUNPRO_C value is the version number */
> #endif
> #ifdef __SUNPRO_CC
>        Sun C++ compiler /* __SUNPRO_CC value is the version number */
> #endif
> #ifdef __sparc
>        generate code for SPARC (R) architecture
> #endif
> #ifdef __sparcv9
>        generate code for 64-bit SPARC architecture
> #endif
> #ifdef __i386
>        generate code for x86 architecture
> #endif
> #ifdef __amd64
>        generate code for x64 architecture
> #endif
> 

Using 'sun' is an extension and has not been recommended for years (decades?)

Strict ISO conforming compilers don't define 'sun', only __sun.
examples: cc -Xc -xc99; gcc -std=c99; clang -std=c99  
         
As I mentioned, there are two issues:
1. building openssl with a strict ISO conforming compiler
2. building other programs including opensslconf.h with a strict ISO compiler

cheers
-- 
Richard PALO




More information about the openssl-dev mailing list