> Date: Wed, 14 Dec 2011 20:54:05 +0100
> From: Pascal Stumpf  <pascal.stu...@cubes.de>
> 
> On Mon, 12 Dec 2011 17:06:19 +0100, Pascal Stumpf wrote:
> > On Mon, 12 Dec 2011 16:55:04 +0100 (CET), Mark Kettenis wrote:
> > > > Date: Mon, 12 Dec 2011 16:51:48 +0100
> > > > From: Pascal Stumpf  <pascal.stu...@cubes.de>
> > > > 
> > > > On Mon, 12 Dec 2011 16:26:42 +0100, Marc Espie wrote:
> > > > > On Mon, Dec 12, 2011 at 04:00:44PM +0100, Pascal Stumpf wrote:
> > > > > > On Mon, 12 Dec 2011 14:41:45 +0100 (CET), Mark Kettenis wrote:
> > > > > > > 
> > > > > > > The s/restrict/__restrict/g in cstdio shouldn't be necessary.
> > > > > > 
> > > > > > Apparently, clang++ interprets "restrict" as parameter name, i.e.:
> > > > > > 
> > > > > > attr.cc:1:50: error: redefinition of parameter 'restrict'
> > > > > > extern "C" int foo(const char * restrict, char * restrict, ...) 
> > > > > >                                                  ^
> > > > > > attr.cc:1:33: note: previous declaration is here
> > > > > > extern "C" int foo(const char * restrict, char * restrict, ...) 
> > > > > >                                 ^
> > > > > > 
> > > > > > This might indeed be a bug, but I'd have to read the C++ standard 
> > > > > > to 
> > be
> > > > > > sure.  In pure C, clang doesn't complain.
> > > > > 
> > > > > I'm not that surprised. restrict is C99.  It's not part of C++98.
> > > > > 
> > > > > Googling for restrict and C++ show various bug-reports explicitly 
> > > > > stati
> > ng
> > >  tha
> > > > > t
> > > > > library headers should probably adapt.
> > > > > 
> > > > > I don't have access to C++ 2011 yet, but from n3242, it seems that it 
> > > > > d
> > oe
> > > s
> > > > > now refer to C99 instead of C89, so restrict is probably leggit in 
> > > > > C++2
> > 01
> > > 1.
> > > > > 
> > > > > So it looks to me like clang in C++98 mode is totally right to not 
> > > > > reco
> > gn
> > > ize
> > > > > restrict as a keyword!
> > > > 
> > > > Yes, you're right.  And clang++ -std=c++0x does recognise restrict as a
> > > > keyword.  cstdio should be adapted (and gcc 4.6 does indeed have
> > > > __restrict over restrict).
> > > 
> > > Still worth checking if only removing the XXX_CHECK defines and
> > > leaving the XXX_DYNAMIC defines helps.
> > 
> > Yes, it does. :)  Thanks!
> 
> So ...  Any oks for this diff?

ok kettenis@

> Index: os_defines.h
> ===================================================================
> RCS file: /cvs/src/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h,v
> retrieving revision 1.2
> diff -u -p -r1.2 os_defines.h
> --- os_defines.h      26 May 2010 11:23:06 -0000      1.2
> +++ os_defines.h      14 Dec 2011 19:53:49 -0000
> @@ -35,11 +35,8 @@
>  // file will come before all others.
>  
>  #define _GLIBCXX_USE_C99 1
> -#define _GLIBCXX_USE_C99_CHECK 1
>  #define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
> -#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
>  #define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || 
> !defined __LONG_LONG_SUPPORTED)
> -#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK 1
>  #define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC defined _XOPEN_SOURCE
>  typedef __builtin_va_list __gnuc_va_list;
>  
> 

Reply via email to