bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test for restrict fails with MS compiler


From: Jerker Bäck
Subject: test for restrict fails with MS compiler
Date: Tue, 10 Jul 2007 15:28:33 +0200

The MS compiler fails the test for the __restrict keyword

Like this:
    typedef int * int_ptr;
    int foo (int_ptr __restrict ip)      // C2219: syntax error

But this works OK:
    typedef int * __restrict int_ptr;
    int foo (int_ptr ip)                // OK

which make sense - not allowing change of a defined custom type

MSDN says:
The __restrict keyword is valid only on variables
__restrict is similar to restrict from the C99 spec, but __restrict can be
used in C++ or C programs


autoconf.m4f(11784), c.m4(1666) from current CVS

  for ac_kw in __restrict __restrict__ _Restrict restrict; do
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
      [[typedef int * int_ptr;
        int foo (int_ptr $ac_kw ip) {
        return ip[0];
       }]],
...

Could be fixed with:

   for ac_kw in __restrict __restrict__ _Restrict restrict; do
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
      [[typedef int * $ac_kw int_ptr;
        int foo (int_ptr ip) {
        return ip[0];
       }]],
...


Tested with compiler version: AMD64 14.0.50722.762 (VS2005 SP1)

Regards Erik







reply via email to

[Prev in Thread] Current Thread [Next in Thread]