[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 19:34:22 -0400 |
On Wed, Jul 17, 2019 at 6:49 PM Jeffrey Walton <address@hidden> wrote:
>
> I'm trying to build cURL, Git, Wget and several other utilities on
> some ancient systems. We still use early Fedora and early Ubuntu VM's
> to regression test. We claim to support GCC 2.95 and above. We test on
> early Fedora and early Ubuntu to verify the claim.
>
> I'm catching a lot of build errors due to Gnulib on early Linux due to
> these definitions from Gnulib 's ctype.h. It looks like GCC disagrees
> with the strategy of defining __THROW to something like throw() in a C
> program.
>
> /* 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. For gcc 3.2 and up we even mark C functions
> as non-throwing using a function attribute since programs can use
> the -fexceptions options for C code as well. */
> # 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
> # else
> # if defined __cplusplus && __GNUC_PREREQ (2,8)
> # define __THROW throw ()
> # define __THROWNL throw ()
> # define __NTH(fct) __LEAF_ATTR fct throw ()
> # define __NTHNL(fct) fct throw ()
> # else
> # define __THROW
> # define __THROWNL
> # define __NTH(fct) fct
> # define __NTHNL(fct) fct
> # endif
> # endif
>
> The strategy results in hundreds of these (encountered when building gettext):
>
> In file included from regex_internal.h:24,
> from regex.c:68:
> /usr/include/ctype.h:192: error: parse error before '{' token
> /usr/include/ctype.h:198: error: parse error before '{' token
> In file included from /usr/include/stdio.h:828,
> from ../gnulib-lib/stdio.h:43,
> from regex_internal.h:25,
> from regex.c:68:
> /usr/include/bits/stdio.h:113: error: parse error before '{' token
> /usr/include/bits/stdio.h:120: error: parse error before '{' token
> In file included from ../gnulib-lib/stdlib.h:36,
> from regex_internal.h:26,
> from regex.c:68:
> /usr/include/stdlib.h:310: error: parse error before '{' token
> /usr/include/stdlib.h:316: error: parse error before '{' token
> /usr/include/stdlib.h:322: error: parse error before '{' token
> /usr/include/stdlib.h:331: error: parse error before '{' token
> /usr/include/stdlib.h:336: error: parse error before '{' token
> /usr/include/stdlib.h:346: error: parse error before '{' token
> /usr/include/stdlib.h:352: error: parse error before '{' token
> /usr/include/stdlib.h:362: error: parse error before '{' token
> /usr/include/stdlib.h:368: error: parse error before '{' token
> /usr/include/stdlib.h:377: error: parse error before '{' token
> /usr/include/stdlib.h:382: error: parse error before '{' token
> /usr/include/stdlib.h:387: error: parse error before '{' token
> /usr/include/stdlib.h:396: error: parse error before '{' token
> In file included from ../gnulib-lib/wchar.h:87,
> from regex_internal.h:31,
> from regex.c:68:
> /usr/include/wchar.h:325: error: parse error before '{' token
> /usr/include/wchar.h:530: error: parse error before '{' token
> /usr/include/wchar.h:534: error: parse error before '{' token
> /usr/include/wchar.h:538: error: parse error before '{' token
> /usr/include/wchar.h:544: error: parse error before '{' token
> /usr/include/wchar.h:547: error: parse error before '{' token
> /usr/include/wchar.h:554: error: parse error before '{' token
> /usr/include/wchar.h:560: error: parse error before '{' token
> In file included from ../gnulib-lib/stdint.h:112,
> from regex_internal.h:34,
> from regex.c:68:
> /usr/include/inttypes.h:399: error: parse error before '{' token
> /usr/include/inttypes.h:417: error: parse error before '{' token
> /usr/include/inttypes.h:433: error: parse error before '{' token
> /usr/include/inttypes.h:452: error: parse error before '{' token
>
> It breaks both early Fedora and early Ubuntu.
This fixes the issue for GCC 3.1 (Fedora 1) and GCC 3.3 (Ubuntu 4).
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.
Jeff
- ctype.h:192: error: parse error before '{' token, Jeffrey Walton, 2019/07/17
- Re: ctype.h:192: error: parse error before '{' token,
Jeffrey Walton <=
- Re: ctype.h:192: error: parse error before '{' token, Paul Eggert, 2019/07/17
- Re: ctype.h:192: error: parse error before '{' token, Jeffrey Walton, 2019/07/17
- Re: ctype.h:192: error: parse error before '{' token, Paul Eggert, 2019/07/17
- Re: ctype.h:192: error: parse error before '{' token, Jeffrey Walton, 2019/07/17
- Re: ctype.h:192: error: parse error before '{' token, Jeffrey Walton, 2019/07/17
- Re: ctype.h:192: error: parse error before '{' token, Paul Eggert, 2019/07/19
Re: ctype.h:192: error: parse error before '{' token, Bruno Haible, 2019/07/17