X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: Message-Id: <200412311451.iBVEpBFq001103@speedy.ludd.ltu.se> Subject: restrict keyword To: DJGPP-WORKERS Date: Fri, 31 Dec 2004 15:51:11 +0100 (CET) X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-ltu-MailScanner-Information: Please contact the ISP for more information X-ltu-MailScanner: Found to be clean X-MailScanner-From: ams AT ludd DOT ltu DOT se Reply-To: djgpp-workers AT delorie DOT com Hello. A long time ago I added restrict to my DJGPP headers as per C99. E.g. here's the patch for time.h (pasted): Index: djgpp/include/time.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/time.h,v retrieving revision 1.8 diff -p -u -r1.8 time.h --- djgpp/include/time.h 16 Feb 2003 04:01:49 -0000 1.8 +++ djgpp/include/time.h 29 Dec 2004 15:51:25 -0000 @@ -57,7 +57,7 @@ double difftime(time_t _t1, time_t _t0) struct tm * gmtime(const time_t *_tod); struct tm * localtime(const time_t *_tod); time_t mktime(struct tm *_tptr); -size_t strftime(char *_s, size_t _n, const char *_format, const struct tm *_tptr); +size_t strftime(char * restrict _s, size_t _n, const char *restrict _format, const struct tm * restrict _tptr); time_t time(time_t *_tod); #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ As I'm using GCC 2.953 I added something like this as well: Index: djgpp/include/sys/version.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/sys/version.h,v retrieving revision 1.5 diff -p -u -r1.5 version.h --- djgpp/include/sys/version.h 17 Oct 2002 23:00:24 -0000 1.5 +++ djgpp/include/sys/version.h 29 Dec 2004 15:51:25 -0000 @@ -1,3 +1,4 @@ +/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ @@ -18,3 +19,6 @@ #define __DJGPP_MINOR 4 #define __DJGPP_MINOR__ 4 +#if __GNUC__ < 3 /* || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)*/ +#define restrict +#endif I also tried the current GCC of that time. It didn't support restrict either, hence the commented out part above. Or rather I don't know exactly why I have commented it out. What I do remember I couldn't get it to work and gave up on GCC >= 3. Do we want this commited? I think yes. Does anyone know the earliest GCC version that supports restrict, if any? I.e. what should the line +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) look like? I'm not sure the right place for it is in but it seemed like a good place with regard to getting it defined everywhere. I'm open for suggestions. Right, MartinS