[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

Manoj Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 30 09:27:10 PDT 2022


manojgupta added a comment.

Tried locally but I still see the warning with -fno-knr-functions. It also says that the argument is unused.

bin/clang --version
clang version 15.0.0 (https://github.com/llvm/llvm-project.git a9d68a5524dea113cace5983697786599cbdce9a <https://reviews.llvm.org/rGa9d68a5524dea113cace5983697786599cbdce9a>)
Target: x86_64-unknown-linux-gnu

$ cat pr.c
void foo(void);

void foo() 
{
}
$ bin/clang -c pr.c -Wstrict-prototypes -fno-knr-functions
clang-14: warning: argument unused during compilation: '-fno-knr-functions' [-Wunused-command-line-argument]
pr.c:3:9: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
void foo()

  ^
   void

1 warning generated.

It works if -fno-knr-functions is passed with Xclang .  Is it intentional that -fno-knr-functions is only a cc1 option? That makes it very hard for us to enable it.

$ bin/clang -c pr.c -Wstrict-prototypes -Xclang -fno-knr-functions (no warnings)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122895/new/

https://reviews.llvm.org/D122895



More information about the cfe-commits mailing list