bug-coreutils
[Top][All Lists]
Advanced

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

Re: [patch] Get coreutils 6.1 to build on a ANSI 89 compiler


From: Pádraig Brady
Subject: Re: [patch] Get coreutils 6.1 to build on a ANSI 89 compiler
Date: Sun, 17 Sep 2006 18:20:55 +0100
User-agent: Mozilla Thunderbird 1.0.8 (X11/20060502)

Jim Meyering wrote:
> Petter Reinholdtsen <address@hidden> wrote:
> 
>>The ANSI C 89 compilers refuses code that fail to declare variables at
>>the start of the block.  I found this problem on RHEL 2.1.  The code
>>refused to compile, and I have to move the variables up to the start
>>of the block to get it building.
>>
>>Here is a quick and dirty patch to solve the issue.  Sorry for not
>>having the time to make it prettier.  For some variables near the end
>>of its block, I just created a new block covering the new variables
>>life spam, while for others, I moved the variable up to the nearest
>>block start.  Please apply this or similar patch to the next relase of
>>coreutils.
> 
> 
> Thanks for the report and patch.
> The note about that in coreutils-6.1's README file would
> have saved you a little time:
> 
>     ***********************
>     Pre-C99 build failure
>     -----------------------
> 
>     There is a new, implicit build requirement:
>     To build the coreutils from source, you should have a C99-conforming
>     compiler, due to the use of declarations after non-declaration statements
>     in several files in src/.  There is code in configure to find and, if
>     possible, enable an appropriate compiler.  However, if configure doesn't
>     find a C99 compiler, it continues nonetheless, and your build will fail.
>     If that happens, simply apply the included patch using the following
>     command, and then run make again:
> 
>       cd src && patch < c99-to-c89.diff
> 
> However, even after that patch, a couple c99'isms remained.
> They should all be fixed for upcoming coreutils-6.2.

If we are supporting c89 compilers with this patch,
wouldn't it be worth going the final step and
applying it automatically with configure?

At least echoing the above text would be useful.

Is determining whether one has a c99 conforming compiler
difficult? If all compilers don't support
constructs like the following, we could have a c99.c
and check for c99.o after the test?

echo "void f(int i) {i++;int j;}" |
$CC -xc -c -o /dev/null - 2>/dev/null && echo c99

Note one can instruct gcc to act like a c89 compiler for testing like:

echo "void f(int i) {i++;int j;}" |
gcc -std=c89 -pedantic -Werror -xc -c -o /dev/null - 2>/dev/null && echo c99

Pádraig.




reply via email to

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