jyknight added a comment.

I think this warning (-Wbuiltin-requires-header) doesn't really make sense as 
its own warning.

We already have two related (on-by-default) warnings.

For declarations:

  test.c:1:6: warning: incompatible redeclaration of library function 'exit' 
[-Wincompatible-library-redeclaration]
  long exit(char *);
       ^
  test.c:1:6: note: 'exit' is a builtin with type 'void (int) 
__attribute__((noreturn))'

And for uses:

  test2.c:1:13: warning: implicitly declaring library function 'exit' with type 
'void (int) __attribute__((noreturn))' [-Wimplicit-function-declaration]
  int foo() { exit(0); }
              ^
  test2.c:1:13: note: include the header <stdlib.h> or explicitly provide a 
declaration for 'exit'

I think for a declaration, if we cannot construct the appropriate type, we 
should be treating all declarations as an incompatible redeclaration, and 
explain why in an attached note, like:

  warning: incompatible redeclaration of library function 'exit' 
[-Wincompatible-library-redeclaration]
  note: missing declaration of type 'jmp_buf' for argument 1 of standard 
function signature.

For a usage, we could emit something like:

  warning: implicit declaration of library function 'setjmp' 
[-Wimplicit-function-declaration]
  note: missing declaration of type 'jmp_buf' for argument 1.
  note: include the header <setjmp.h> or explicitly provide a declaration for 
'setjmp'


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58091



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

Reply via email to