This content has been marked as final. Show 7 replies
I can't duplicate your problem on my RHEL6 system. The line
compiles without errors or warnings using the Studio 12.3 C compiler.
In addition, I do not see any instances of _Pragma in file /usr/include/string.h.
Please post the contents of file /etc/redhat-release, and if it exists, the contents of file /etc/oracle-release.
Please also do this:
% cat z.c
% /path/to/studio/cc -P z.c
% /path/to/studio/cc -c z.i
You should see the same error message, but with a different line number. Find that line in z.i and show the line here.
Sudden thought: Sometimes defining macros causes bizarre results. Are there any macros defined on the cc command line or in project header files that are included before <string.h>?
Edited by: Steve_Clamage on May 10, 2012 9:06 AM
I found that the problem is related to the setting of the -xc99 option.
It was set to -xc99=%none. If I remove the -xc99 option the programs compile (with a lot of warnings) so I will have to check the implications of this.
On RHEL5 the -xc99=%none does not give problems.
Indeed, the checks in the file sys/cdefs.h provided with the compiler are wrong. They define __REDIRECT_NTH to use Pragma when _USE_ISOC99 is defined, but that macro can end up defined (by features.h) even when the compiler is not in C99 mode.
Thanks very much - Now at least I know the reason for the problem. ¨
I will investigate this further, but if anybody has already found a solution I would of course appreciate to hear about it.
I have made a temporary fix by inserting an #undef __USE_ISOC99 statement in /usr/include/features.h just before sys/cdefs.h is included,
This is of course not a proper solution as it will probably cause problems if -xc99=none is not specified, but it solves my immediate problem until a proper fix becomes available.
You could try replacing the test for __USE_ISOC99 with one for __C99FEATURES__ in prod/include/cc/sys/cdefs.h (no guarantee, I am not from Oracle).
A bug report (CR) 7169376 has filed for this problem. If you have a service contract with Oracle, you can refer to this CR number and request a patch via your support channel.
Merci, Marc, for finding the problem before anyone here at Oracle had a chance to look at it. :-)