jyknight added a comment.

The warnings for this case aren't great:

  int foo();
  
  int
  foo(int arg) {
    return 5;
  }

results in:

  /tmp/test.c:1:5: warning: a function declaration without a prototype is 
deprecated in all versions of C and is not supported in C2x 
[-Wdeprecated-non-prototype]
  int foo();
      ^
          void
  /tmp/test.c:4:1: warning: a function declaration without a prototype is 
deprecated in all versions of C and is not supported in C2x 
[-Wdeprecated-non-prototype]
  foo(int arg) {
  ^

Two warnings for the problem, instead of a warning and a note, plus, the fix-it 
hint is incorrect, which the compiler should know, since we see that there are 
arguments expected.

I'd expect more like:

  /tmp/test.c:1:5: warning: a function declaration without a prototype is 
deprecated in all versions of C and is not supported in C2x 
[-Wdeprecated-non-prototype]
  int foo();
  /tmp/test.c:4:1: note: subsequent declaration specifies arguments.
  foo(int arg) {
      ^


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