Subject: __restrict and arrays
To: None <tech-toolchain@netbsd.org, tech-userlevel@netbsd.org>
From: Mindaugas R. <rmind@NetBSD.org>
List: tech-toolchain
Date: 06/17/2007 05:06:15
Hello,
there is an issue with GCC 3.x and aio.h file. This header contains such line:

int	lio_listio(int, struct aiocb * const __restrict [],
		    int, struct sigevent * __restrict);

There should be a C99 specifier "[__restrict]", which is actually not
compatible with older GCC versions than 3.1.  I am not sure what would be an
appropriate way to fix this...

a) Declare something like __restrict_array macro in sys/cdefs.h :
#if __GNUC_PREREQ__(3, 1)
#define	__restrict_array	__restrict
#else
#define	__restrict_array	/* Nothing */
#endif
It would be used as:
	struct aiocb * const [__restrict_array]

b) Instead, use something like:
	struct aiocb * const __restrict *

Any suggestions?
Thanks.

-- 
Best regards,
Mindaugas
www.NetBSD.org