diff options
author | Martin Sebor <msebor@redhat.com> | 2018-11-15 22:18:54 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2018-11-15 15:18:54 -0700 |
commit | cd5da9837b26d77136d3a9394747ce4325a95118 (patch) | |
tree | 9a3374d29ebe69ec33462c7e9550317679a7a341 /gcc/doc | |
parent | 2a4030effa436cc4c6a537e633b0b0338b2b3ad4 (diff) | |
download | gcc-cd5da9837b26d77136d3a9394747ce4325a95118.zip gcc-cd5da9837b26d77136d3a9394747ce4325a95118.tar.gz gcc-cd5da9837b26d77136d3a9394747ce4325a95118.tar.bz2 |
PR c/83656 - missing -Wbuiltin-declaration-mismatch on declaration without prototype
gcc/c/ChangeLog:
PR c/83656
* c-decl.c (header_for_builtin_fn): Declare.
(diagnose_mismatched_decls): Diagnose declarations of built-in
functions without a prototype.
* c-typeck.c (maybe_warn_builtin_no_proto_arg): New function.
(convert_argument): Same.
(convert_arguments): Factor code out into convert_argument.
Detect mismatches between built-in formal arguments in calls
to built-in without prototype.
(build_conditional_expr): Same.
(type_or_builtin_type): New function.
(convert_for_assignment): Add argument. Conditionally issue
warnings instead of errors for mismatches.
gcc/testsuite/ChangeLog:
PR c/83656
* gcc.dg/20021006-1.c
* gcc.dg/Wbuiltin-declaration-mismatch.c: New test.
* gcc.dg/Wbuiltin-declaration-mismatch-2.c: New test.
* gcc.dg/Wbuiltin-declaration-mismatch-3.c: New test.
* gcc.dg/Wbuiltin-declaration-mismatch-4.c: New test.
* gcc.dg/Walloca-16.c: Adjust.
* gcc.dg/Wrestrict-4.c: Adjust.
* gcc.dg/Wrestrict-5.c: Adjust.
* gcc.dg/atomic/stdatomic-generic.c: Adjust.
* gcc.dg/atomic/stdatomic-lockfree.c: Adjust.
* gcc.dg/initpri1.c: Adjust.
* gcc.dg/pr15698-1.c: Adjust.
* gcc.dg/pr69156.c: Adjust.
* gcc.dg/pr83463.c: Adjust.
* gcc.dg/redecl-4.c: Adjust.
* gcc.dg/tls/thr-init-2.c: Adjust.
* gcc.dg/torture/pr55890-2.c: Adjust.
* gcc.dg/torture/pr55890-3.c: Adjust.
* gcc.dg/torture/pr67741.c: Adjust.
* gcc.dg/torture/stackalign/sibcall-1.c: Adjust.
* gcc.dg/torture/tls/thr-init-1.c: Adjust.
* gcc.dg/tree-ssa/builtins-folding-gimple-ub.c: Adjust.
From-SVN: r266194
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 535b258..1bf2501 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -7063,9 +7063,26 @@ attributes. @item -Wno-builtin-declaration-mismatch @opindex Wno-builtin-declaration-mismatch @opindex Wbuiltin-declaration-mismatch -Warn if a built-in function is declared with the wrong signature or -as non-function. -This warning is enabled by default. +Warn if a built-in function is declared with an incompatible signature +or as a non-function, or when a built-in function declared with a type +that does not include a prototype is called with arguments whose promoted +types do not match those expected by the function. When @option{-Wextra} +is specified, also warn when a built-in function that takes arguments is +declared without a prototype. The @option{-Wno-builtin-declaration-mismatch} +warning is enabled by default. To avoid the warning include the appropriate +header to bring the prototypes of built-in functions into scope. + +For example, the call to @code{memset} below is diagnosed by the warning +because the function expects a value of type @code{size_t} as its argument +but the type of @code{32} is @code{int}. With @option{-Wextra}, +the declaration of the function is diagnosed as well. +@smallexample +extern void* memset (); +void f (void *d) +@{ + memset (d, '\0', 32); +@} +@end smallexample @item -Wno-builtin-macro-redefined @opindex Wno-builtin-macro-redefined |