This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

__restrict for arrays


Howdy,

My bootstrap fails on i586-pc-linux-gnu, with the following error:

/home/kraai/dev/gcc/objdir/gcc/g++ -B/home/kraai/dev/gcc/objdir/gcc/ -nostdinc++ -nostdinc++ -I/home/kraai/dev/gcc/objdir/i586-pc-linux-gnu/libstdc++-v3/include -I/home/kraai/dev/gcc/libstdc++-v3/include -I/home/kraai/dev/gcc/libstdc++-v3/include/std -I/home/kraai/dev/gcc/libstdc++-v3/include/c_std -I/home/kraai/dev/gcc/libstdc++-v3/libsupc++ -I/home/kraai/dev/gcc/libstdc++-v3/libio -I/home/kraai/dev/gcc/libstdc++-v3/testsuite -I/home/kraai/dev/gcc/libstdc++-v3/include/backwards -I/home/kraai/dev/gcc/libstdc++-v3/include/ext -L/home/kraai/dev/gcc/objdir/i586-pc-linux-gnu/libstdc++-v3/src -L/home/kraai/dev/gcc/objdir/i586-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/i586-pc-linux-gnu/bin/ -B/usr/local/i586-pc-linux-gnu/lib/ -isystem /usr/local/i586-pc-linux-gnu/include -DHAVE_CONFIG_H -I. -I/home/kraai/dev/gcc/libjava -I./include -I./gcj -I/home/kraai/dev/gcc/libjava -Iinclude -I/home/kraai/dev/gcc/libjava/include -I/home/kraai/dev/gcc/libjava/../boehm-gc/include -DSILENT=1 -DNO_SIGNALS=1 -DJAVA_FINALIZATION=1 -DGC_GCJ_SUPPORT=1 -I/home/kraai/dev/gcc/libjava/libltdl -I/home/kraai/dev/gcc/libjava/libltdl -I/home/kraai/dev/gcc/libjava/../gcc -I/home/kraai/dev/gcc/libjava/../zlib -I/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -D__NO_MATH_INLINES -ffloat-store -I/usr/X11R6/include -W -Wall -D_GNU_SOURCE -g -O2 -D_GNU_SOURCE -Wp,-MD,.deps/natInetAddress.pp -c /home/kraai/dev/gcc/libjava/java/net/natInetAddress.cc  -fPIC -DPIC -o java/net/.libs/natInetAddress.o
In file included from /home/kraai/dev/gcc/libjava/java/net/natInetAddress.cc:42:
/usr/include/netdb.h:497: parse error before `]' token
make[3]: *** [java/net/natInetAddress.lo] Error 1

Looking in netdb.h, the erroneous line is the following:

extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
                          int __ent, struct sigevent *__restrict __sig)
     __THROW;

This preprocesses to the following:

extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict],
                          int __ent, struct sigevent *__restrict __sig)
     throw ();

Looking around, I found the following in <sys/cdefs.h>:

/* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
     array_name[restrict]
   GCC 3.1 supports this.  */
#if __GNUC_PREREQ (3,1)
# define __restrict_arr __restrict

Some experimentation shows that the following compiles under C but
not C++:

int foo (int bar[__restrict]);

Is this feature supposed to be supported in C++, or should the
header file be changed to enable it in C only?

This all shows up on a Debian sid system.  Paper cuts on the
bleeding edge, I guess.  The libc6-dev package is 2.2.3-5.

Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]