------- Comment #12 from heydowns at borg dot com 2009-07-10 14:41 ------- Trying to give some answers to Joseph's questions in comment 9.
The best documentation I found on what, exactly, the various object files do is actually the man pages for the Sun Studio compilers and the OpenSolaris source code for values-*.c Choice of values-xpg*.o and values-X*.o are someone independent, so I'm splitting up the explanation. First, values-xpg*.o: Link Tool & Flags Link Result Comment c89 values-xpg4.o c99 values-xpg6.o cc -xc99=all,no_lib Neither Default -xc99 option c99 language features, no c99 library support cc -xc99=all values-xpg6.o c99 lang feat. & lib support cc -xc99=none Neither No c99 at all So, values-xpg6.o clearly enables c99 behavior of system libraries where there is a runtime difference. It also enables the preference of XPG4 behavior over XPG3 behavior (as below). >From looking at the OpenSolaris source code for values-xpg4.o, it is stated that linking in that object file enables "xpg4 mode for APIs which have differing runtime behavior from xpg3 to xpg4". Lastly, from man page 'standards', the only time "cc" is recommended as a compiler (instead of c89 or c99, and thus not linking any of values-xpg*.o) is when you want to conform to SVID3 or CAE XPG3. What is the runtime difference of xpg3 versus xpg4? I really don't know - maybe someone can help here. But, back to Joseph's question, the inclusion values-xpg*.o does not seem to deal with extensions to standard behavior; rather it does sound like it controls the standard to which functions should conform. Based on this I am leaning towards saying values-xpg4.o should be enabled for -std=gnu89. I'd appreciate comments in light of the above. (please note that this would make it non-trivial to link for xpg3 behavior). values-X{c,a,t,s}.o are what seem to control how strict the implementation follows the standard. Currently gcc only ever uses values-X{a,c}.o which is probably sufficient, and I don't think that this needs to change at all: -std=gnu* -> values-Xa.o otherwise -> values-Xc.o values-Xa is described as "ANSI conforming mode" whereas -Xc is "Strict ANSI mode" in the Open Solaris sources. The 'cc' man page documents -Xa as ISO C plus K&R C compatibility extensions, plus semantic changes required by ISO C, preferring ISO C semantics where there is conflict. -Xc is documented as "Strictly conforming" ISO C, no K&R extensions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40411