Subject: Re: ares_init.c:1614: error: 'for' loop initial declaration used outside C99 mode

Re: ares_init.c:1614: error: 'for' loop initial declaration used outside C99 mode

From: Jeffrey Walton <noloader_at_gmail.com>
Date: Sat, 18 Jul 2020 01:50:39 -0400

On Sat, Jul 18, 2020 at 12:59 AM Zan Lynx <zlynx_at_acm.org> wrote:
>
> On 7/17/2020 10:07 PM, Jeffrey Walton wrote:
> >
> > I'm building c-ares-1.16.1 on an antique PowerMac G5. The machine has
> > GCC 4.0.1. I'm catching a compile error:
> >
> > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.
> > -DCARES_BUILDING_LIBRARY -DCARES_SYMBOL_HIDING -isystem
> > /usr/local/include -DNDEBUG -fvisibility=hidden -O2 -mlong-double-64
> > -fPIC -pthread -g0 -Wno-system-headers -MT
> > libcares_la-ares_library_init.lo -MD -MP -MF
> > .deps/libcares_la-ares_library_init.Tpo -c ares_library_init.c
> > -fno-common -DPIC -o .libs/libcares_la-ares_library_init.o
> > ares_init.c: In function 'init_by_resolv_conf':
> > ares_init.c:1614: error: 'for' loop initial declaration used outside C99 mode
> > ares_init.c:1643: error: 'for' loop initial declaration used outside C99 mode
> > make[2]: *** [libcares_la-ares_init.lo] Error 1
> >
> I believe that compiler is too old to default to C99. You might make
> this work by specifying the compiler standard in the CFLAGS. Try
> "-std=c99" or "-std=gnu99"

Thanks Zan.

I was not sure what Daniel is aiming for - c89 or c99.

Based on the README:

    We cannot assume anything else but very basic compiler features
    being present. While c-ares requires an ANSI C compiler to build,
    some of the earlier ANSI compilers clearly can't deal with some
    preprocessor operators.

it sounded like he wanted something closer to c89.

Jeff
Received on 2020-07-18