[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [POLL] C99, declaration after statement
From: |
Pádraig Brady |
Subject: |
Re: [POLL] C99, declaration after statement |
Date: |
Sun, 25 Sep 2011 14:25:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
On 09/25/2011 09:14 AM, Gary V. Vaughan wrote:
> Hi Paul,
>
> On 25 Sep 2011, at 13:09, Paul Eggert wrote:
>
>> On 09/24/11 22:31, Gary V. Vaughan wrote:
>>> $ cc -o hello hello.c
>>> cc-1241 cc: ERROR File = hello.c, Line = 7
>>> A declaration cannot appear after an executable statement in a block.
>>
>> You're supposed to use cc's -c99 flag, no?
>> Or compile with c99? Then declarations after statements
>> should work; see, for example
>> <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00241.html>.
>
> D'oh! Quite right.
>
> There must be some side effect that -c99 has which prevents me from just
> turning it on indiscriminately... Unfortunately I don't remember what, only
> that I've had to go through adding braces to make extra scopes around out
> of order declarations.
>
> I'll keep an eye out for an example and post it here when I find it.
>
>> Is 'configure' not doing this for you automatically?
>> If so, then let's fix that.
>
> How will configure know whether it needs to use -c99 mode or not? I tend
> to set CC and CFLAGS per host/compiler pair anyway, so I wouldn't notice
> if configure is trying to pick the flags for me.
>
> Cheers,
AC_PROG_CC_STDC should try to enable C99 first and then C89
There is also AC_PROG_CC_C99, since autoconf 2.59c (Apr 2006).
If doing this in gnulib we should also remove the
-Wdeclaration-after-statement from m4/manywarnings.m4
cheers,
Pádraig.
- Re: [PATCH 8/8] fts: do not exhaust memory when processing million-entry directories, (continued)
- Re: [PATCH 8/8] fts: do not exhaust memory when processing million-entry directories, Jim Meyering, 2011/09/24
- Re: C99, declaration after statement, Bruno Haible, 2011/09/24
- Re: C99, declaration after statement, Jim Meyering, 2011/09/24
- [POLL] C99, declaration after statement, Bruno Haible, 2011/09/24
- Re: [POLL] C99, declaration after statement, Eric Blake, 2011/09/24
- Re: [POLL] C99, declaration after statement, Gary V. Vaughan, 2011/09/25
- Re: [POLL] C99, declaration after statement, Paul Eggert, 2011/09/25
- Re: [POLL] C99, declaration after statement, Gary V. Vaughan, 2011/09/25
- Re: [POLL] C99, declaration after statement, Paul Eggert, 2011/09/25
- Re: [POLL] C99, declaration after statement, Gary V. Vaughan, 2011/09/25
- Re: [POLL] C99, declaration after statement,
Pádraig Brady <=
- Re: [POLL] C99, declaration after statement, Paul Eggert, 2011/09/25
- Re: [POLL] C99, declaration after statement, Bruno Haible, 2011/09/25
- Re: [POLL] C99, declaration after statement, Paul Eggert, 2011/09/25