distributions.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
To: distributions@lists.linux.dev
Subject: Re: ISO C23 removal of unprototyped functions
Date: Wed, 8 Feb 2023 05:02:05 -0600	[thread overview]
Message-ID: <199D8658-C6E9-434F-8F5D-B0D79A86080C@Wilcox-Tech.com> (raw)
In-Reply-To: <2354211.7hzS34FegO@nimes>

On Feb 7, 2023, at 6:14 AM, Bruno Haible <bruno@clisp.org> wrote:
> 
> Seen in the GCC change log [1]: Joseph Myers wrote:
> 
> "
>  C2x has completely removed unprototyped functions, so that () now
>  means the same as (void) in both function declarations and
>  definitions, where previously that change had been made for
>  definitions only.  Implement this accordingly.
> 
>  This is a change where GNU/Linux distribution builders might wish to
>  try builds with a -std=gnu2x default to start early on getting old
>  code fixed that still has () declarations for functions taking
>  arguments, in advance of GCC moving to -std=gnu2x as default maybe in
>   GCC 14 or 15; I don't know how much such code is likely to be in
>  current use.
> "
> 
> There were two essential changes in this area in ISO C 23:
>  * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf
>    1) removed the K&R C syntax for function definitions
>         int foo (x, y) int x; long y; { ... }
>    2) in function definitions, () is equivalent to (void).
>  * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm
>    3) A function declarator with a parameter list of () declares a prototype
>       for a function that takes no parameters (like it does in C++).
>       See ISO C 23 § 6.7.6.3.(13).
> 
> [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0a4b219d39c74ae


What is the minimum version of GCC to detect this?

Is there a warning flag that could pick it up before this commit was
introduced?

Is the only released compiler that can warn on this Clang 15?[1]

Sorry if this seems silly, but we’re not even at GCC 12 yet in Adélie
and I’d still really like to do some work on this in my spare time.

Best,
-A.

[1]: https://github.com/madler/zlib/issues/633#issuecomment-1419525514


--
A. Wilcox (they/them)
SW Engineering: C/C++, DevOps, POSIX
Wilcox Technologies Inc.


  parent reply	other threads:[~2023-02-08 11:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 12:14 ISO C23 removal of unprototyped functions Bruno Haible
2023-02-07 13:58 ` alice
2023-02-08 11:02 ` A. Wilcox [this message]
2023-02-08 12:01   ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199D8658-C6E9-434F-8F5D-B0D79A86080C@Wilcox-Tech.com \
    --to=awilcox@wilcox-tech.com \
    --cc=distributions@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).