bug-gnulib
[Top][All Lists]
Advanced

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

Re: ctype.h:192: error: parse error before '{' token


From: Jeffrey Walton
Subject: Re: ctype.h:192: error: parse error before '{' token
Date: Wed, 17 Jul 2019 21:17:18 -0400

On Wed, Jul 17, 2019 at 9:03 PM Paul Eggert <address@hidden> wrote:
>
> Jeffrey Walton wrote:
> > This fixes the issue for GCC 3.1 (Fedora 1) and GCC 3.3 (Ubuntu 4).
>
> I don't see how that patch could fix the issue for GCC 3.1, since it simply
> changes a test to check for GCC 3.4 instead of 3.3, so GCC 3.1 should behave 
> the
> same regardless of whether the patch is installed.
>
> > for file in $(find "$PWD" -name '*.h')
> > do
> >      if [[ ! -f "$file" ]]; then
> >          continue
> >      fi
> >
> >      sed -e 's|__GNUC_PREREQ (3, 3)|__GNUC_PREREQ (3, 4)|g' "$file" >
> > "$file.fixed"
> >      mv "$file.fixed" "$file"
> > done
> >
> > I don't know if the issue is present in GCC 3.4.
>
> The only instance of '__GNUC_PREREQ (3, 3)' is the one in lib/cdefs.h, so I
> assume that's the only thing causing you problems. The '__GNUC_PREREQ (3, 3)'
> comes straight from glibc misc/sys/cdefs.h (installed as
> /usr/include/sys/cdefs.h on my platform). So if there's a problem here,
> presumably the problem is also in current glibc.
>
> Can you investigate why current glibc's approach does not work for you, 
> whereas
> old-fashioned glibc does? For example, what does /usr/include/sys/cdefs.h look
> like on these older platforms, and why do their definitions of __THROW work 
> when
> Gnulib's doesn't?

It looks like the glibc macro is a little simpler and lacks the attributes:

/* GCC can always grok prototypes.  For C++ programs we add throw()
   to help it optimize the function calls.  But this works only with
   gcc 2.8.x and egcs.  */
# if defined __cplusplus && __GNUC_PREREQ (2,8)
#  define __THROW       throw ()
# else
#  define __THROW
# endif

In contrast here is the macro in effect for Gnulib:

# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
#  define __THROW       __attribute__ ((__nothrow__ __LEAF))
#  define __THROWNL     __attribute__ ((__nothrow__))
#  define __NTH(fct)    __attribute__ ((__nothrow__ __LEAF)) fct
#  define __NTHNL(fct)  __attribute__ ((__nothrow__)) fct
...

This may be helpful:

$ gcc --version
gcc (GCC) 3.3.4 (Debian 1:3.3.4-9ubuntu5)
Copyright (C) 2003 Free Software Foundation, Inc.

Attached is the sys/cdefs.h file.

I don't know the compiler options glibc used way back when. If you
know how to look them up, then I can run the commands.

Jeff

Attachment: sys-cdefs.txt
Description: Text document


reply via email to

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