Hello!

I got another problem with GCC 4.6.3 -- I cannot compile files that includes /usr/include/spawn.h in C++ mode:

$ cat a.cpp
#include <spawn.h>
$ /opt/csw/gcc4/bin/g++ -c a.cpp
In file included from a.cpp:1:0:
/usr/include/spawn.h:42:14: error: expected ',' or '...' before 'argv'
/usr/include/spawn.h:50:14: error: expected ',' or '...' before 'argv'
$ cat -n /usr/include/spawn.h
...
    35  #if defined(__STDC__)
    36
    37  extern int posix_spawn(
    38          pid_t *_RESTRICT_KYWD pid,
    39          const char *_RESTRICT_KYWD path,
    40          const posix_spawn_file_actions_t *file_actions,
    41          const posix_spawnattr_t *_RESTRICT_KYWD attrp,
    42          char *const argv[_RESTRICT_KYWD],
    43          char *const envp[_RESTRICT_KYWD]);
    44
    45  extern int posix_spawnp(
    46          pid_t *_RESTRICT_KYWD pid,
    47          const char *_RESTRICT_KYWD file,
    48          const posix_spawn_file_actions_t *file_actions,
    49          const posix_spawnattr_t *_RESTRICT_KYWD attrp,
    50          char *const argv[_RESTRICT_KYWD],
    51          char *const envp[_RESTRICT_KYWD]);
...

When preprocessed this file:

$ /opt/csw/gcc4/bin/g++ -E a.cpp
...
extern int posix_spawn(
 pid_t *__restrict pid,
 const char *__restrict path,
 const posix_spawn_file_actions_t *file_actions,
 const posix_spawnattr_t *__restrict attrp,
char *const argv[__restrict], // <----------- SBN: line 42 of /usr/include/spawn.h
 char *const envp[__restrict]);

So looks like GCC don't understand __restrice keyword in array-brackets.

$ uname -a
SunOS rock1 5.10 Generic_147441-15 i86pc i386 i86pc
$ cat /etc/release
                    Oracle Solaris 10 8/11 s10x_u10wos_17b X86
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
                            Assembled 23 August 2011

GCC 4.5.1 from Blastwave successfully compiled this file.
The difference is that _RESTRICT_KYWD expanded in it to empty string.
AFAIU this is due to GCC 4.6.3 defines __STDC_VERSION__ macro to 199901L in C++ mode

$ /opt/csw/gcc4/bin/gcc -x c++ -dM -E - </dev/null | grep STDC
#define __STDC_HOSTED__ 1
#define __STDC_VERSION__ 199901L

There is no such definition for 4.5.1

Any suggestions?
Thanks!
_______________________________________________
users mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/users

Reply via email to