Fix invalid use of restrict

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Nov 28 10:34:00 GMT 2013


On Nov 28 14:06, Alexpux wrote:
> 
> 28 нояб. 2013 г., в 14:04, Corinna Vinschen написал(а):
> 
> > On Nov 28 12:03, Alexey Pavlov wrote:
> >> In CVS version I get error: invalid use of restrict. Patch for it is below
> > 
> > Thanks, applied.  Why on earth does none of my GCCs throw an error
> > or warning about this?!?
> 
> Because I got this error not on building runtime but when build other program with this headers.

But glob.cc includes glob.h as well.  It should have picked up the wrong
definition and ... oh, darn.  "restrict" is filtered out in C++ because
it's a C99 keyword.  Here's what sys/cdefs.h does:

  #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
  #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
  #define __restrict
  #else
  #define __restrict      restrict
  #endif
  #endif

__STDC_VERSION__ is not defined when building C++ files.

However, G++ knows the __restrict and __restrict__ keyword, so I wonder
if we shouldn't enable __restrict when building C++ with g++.  I guess
I'll discuss this on the newlib list.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20131128/950bdc8b/attachment.sig>


More information about the Cygwin-developers mailing list