Bug 88687 - redundant -Wbuiltin-declaration-mismatch after -Wimplicit-function-declaration
Summary: redundant -Wbuiltin-declaration-mismatch after -Wimplicit-function-declaration
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 9.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks: 91092
  Show dependency treegraph
 
Reported: 2019-01-04 03:52 UTC by Martin Sebor
Modified: 2024-02-17 05:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-02-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Sebor 2019-01-04 03:52:51 UTC
The -Wbuiltin-declaration-mismatch warning below should probably only be issued if -Wimplicit-function-declaration is disabled, otherwise it's mostly redundant (although only one instance of the latter warning is issued for each implicit declaration regardless of the number of calls).

In addition, the <built-in>: note  after the -Wbuiltin-declaration-mismatch warning is meaningless.

$ cat t.c && gcc -O2 -S -Wall -Wextra t.c
int f (const char *s)
{
  return memcmp (s, "1234", 4);
}
t.c: In function ‘f’:
t.c:3:10: warning: implicit declaration of function ‘memcmp’ [-Wimplicit-function-declaration]
    3 |   return memcmp (s, "1234", 4);
      |          ^~~~~~
t.c:3:29: warning: ‘memcmp’ argument 3 type is ‘int’ where ‘long unsigned int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
    3 |   return memcmp (s, "1234", 4);
      |                             ^
<built-in>: note: built-in ‘memcmp’ declared here
Comment 1 Sam James 2024-02-17 05:09:49 UTC
Confirmed. I wasn't sure if this would've gone away with some of the earlier diagnostic fixups wrt permerror but it hasn't.