config-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Modernize more C programs in config.guess.


From: Petr Vorel
Subject: Re: [PATCH] Modernize more C programs in config.guess.
Date: Thu, 4 Apr 2024 23:16:58 +0200

Hi Zack,

Reviewed-by: Petr Vorel <petr.vorel@gmail.com>

> Specifically, on top of Petr Vorel’s patch, eliminate all use of
> old-style function definitions and implicit function declarations.

> Many of the C programs embedded in config.guess are only used on very
> old systems that may never have had an ISO C compiler (other than gcc,
> which we cannot assume has been installed) so we have to do this
> carefully.  I assume that stdio.h exists unconditionally, and that
> either it declares puts and printf, or the compiler is so old that
> implicit function declarations are the order of the day.  I also
> assume it is safe to declare main as ‘int main (void)’; that may need
> to get reverted.  All uses of ‘exit’ are replaced with returning from
> main, so that we do not need to worry about whether stdlib.h exists.

I would personally separate return 0 + <stdio.h> change (exit() + <stdlib.h>
replacement into separate commit) and printf() => puts() into it's own commit.
It's unrelated to the preprocessor change, it'd be slightly easier to read the
change (you're actually changing 3 things in single commit).

> The only C program that took command line arguments, and therefore
> needed to declare main with arguments, is replaced with a
> preprocessor-only check and string manipulation from shell.

+1

> Wherever possible, uses of printf are demoted to puts.
What was the reason of this? Both are in <stdio.h>, right?

Kind regards,
Petr



reply via email to

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