[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/1] config.guess: Use int
From: |
Zack Weinberg |
Subject: |
Re: [PATCH 1/1] config.guess: Use int |
Date: |
Thu, 04 Apr 2024 11:19:33 -0400 |
User-agent: |
Cyrus-JMAP/3.11.0-alpha0-333-gbfea15422e-fm-20240327.001-gbfea1542 |
On Wed, Apr 3, 2024, at 1:49 PM, Petr Vorel wrote:
>> On Wed, Apr 3, 2024, at 1:01 PM, Petr Vorel wrote:
>> > Although -Wmain-return-type is not considered as error (unlike
>> > -Wimplicit-int on gcc 14 and clang 16), but just a warning, let's fix it
>> > for the future.
>> We want the end result to be
>> int
>> main (void)
>
> Sure, I'll do it in v2. May I know the reason for this?
As Jacob explained, this is a GNU style requirement. I don't think it
is super important for test programs embedded in config.guess; it is
unlikely that anyone would want to use on this file the tools that look
for C function definitions by scanning for identifiers at the left
margin. However, as other test programs in this file do conform to the
convention, we should be consistent and use it throughout.
Writing `(void)` instead of `()` for definitions and prototypes of
functions that take no arguments is much more important; in the 1989
through 2011 revisions of the C standard, `()` declares a function that
takes *an unspecified number* of arguments, not a function that takes no
arguments. I'm actually kind of annoyed with the C committee for
changing `()` to mean no arguments in C202x; if it were up to me I would
have made that an *error*.
> Does this rule (return type on a separate line) applies to main with
> args (Ben is the author)?
Yes it does, but the test program you quote has several other problems
for new-fangled compilers. Let's fix all of those problems in a
separate patch (I will send one).
zw