Re: "errno" not set in case of "libm" functions (HPUX)
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ibrar Ahmed <ibrar.ahmad@gmail.com>, pgsql-hackers@postgresql.org
Date: 2011-05-24T18:00:08Z
Lists: pgsql-hackers
On 24.05.2011 20:44, Tom Lane wrote: > BTW, is it really true that HP decided they could make the compiler's > default behavior violate the C standard so flagrantly? I could believe > offering a switch that you had to specify to save a few cycles at the > cost of nonstandard behavior; but if your report is actually correct, > their engineering standards have gone way downhill since I worked there. > I wonder whether you are inserting some other nonstandard switch that > turns on this effect. This (http://docs.hp.com/en/B3901-90015/ch02s07.html) says: > +O[no]libmerrno > > Description: > > This option enables[disables] support for errno in libm functions. The default is +Onolibmerrno. > > In C++ C-mode, the default is +Olibmerrno with -Aa option. So the default is indeed non-standard. But I wonder if we should use -Aa instead? The documentation I found for -Aa (http://docs.hp.com/en/B3901-90017/ch02s22.html) says: > -Aa > > The -Aa option instructs the compiler to use Koenig lookup and strict ANSI for scope rules. This option is equivalent to specifying -Wc,-koenig_lookup,on and -Wc,-ansi_for_scope,on. > > The default is off. Refer to -Ae option for C++ C-mode description. The standard features enabled by -Aa are incompatible with earlier C and C++ features. That sounds like what we want. Apparently that description is not complete, and -Aa changes some other behavior to ANSI C compatible as well, like +Olibmerrno. There's also -AC99, which specifies compiling in C99-mode - I wonder if that sets +Olibmerrno too. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com