public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/95445] diagnose incompatible calls to functions declared without prototype
Date: Fri, 12 May 2023 15:54:03 +0000	[thread overview]
Message-ID: <bug-95445-4-54FHjaaeaC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95445-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95445

Florian Weimer <fw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fw at gcc dot gnu.org

--- Comment #2 from Florian Weimer <fw at gcc dot gnu.org> ---
Current Clang warns like this:

t.c:17:5: warning: passing arguments to 'g' without a prototype is deprecated
in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  g (1);                     // (presumably) okay, f's type is 'void (int)'
    ^
t.c:18:5: warning: passing arguments to 'g' without a prototype is deprecated
in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  g ("foo");                 // should be diagnosed
    ^
t.c:19:5: warning: passing arguments to 'g' without a prototype is deprecated
in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  g (1, "bar");              // ditto
    ^

Maybe that's sufficient?

Trying to infer the type of g from its uses seems to be rather questionable.
For K&R projects, GCC already has -flto -Wlto-type-mismatch, which can diagnose
violations across translation units.

  parent reply	other threads:[~2023-05-12 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 22:32 [Bug c/95445] New: " msebor at gcc dot gnu.org
2020-05-30 22:32 ` [Bug c/95445] " msebor at gcc dot gnu.org
2021-10-27  5:21 ` egallager at gcc dot gnu.org
2023-05-12 15:54 ` fw at gcc dot gnu.org [this message]
2023-05-12 16:29 ` sjames at gcc dot gnu.org

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=bug-95445-4-54FHjaaeaC@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).