aaron.ballman added a comment.

In D122895#3484076 <https://reviews.llvm.org/D122895#3484076>, @manojgupta 
wrote:
> 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)

No, that's not at all intentional -- it should be exposed as a driver flag. I 
can reproduce the issue locally and will fix this today (it's very strange 
because the option is listed as a CoreOption should it should be exposed 
through the driver). I'm very sorry for the trouble, but thank you for catching 
this!

In D122895#3484077 <https://reviews.llvm.org/D122895#3484077>, @manojgupta 
wrote:

> Following behavior is also surprising:
>
> ` -Werror -Wimplicit-function-declaration` does not rep-promote it to an 
> error either if I suppress it globally with 
> -Wno-error=implicit-function-declaration.

On its face, I agree that it's surprising, but that's the general behavior of 
`-Werror` when warning flags default to an error, and is not specific to the 
changes here: https://godbolt.org/z/ronq687cj


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122895

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to