diff options
author | Florian Weimer <fweimer@redhat.com> | 2025-05-01 19:06:45 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2025-05-01 19:06:45 +0200 |
commit | b6d37ec1dd2a228d94e7b5b438f3aa53684316bc (patch) | |
tree | 7fe780ddc008839a0f9e13b7b8a38b113f5bb392 /gcc | |
parent | 08ce1b9f6707e00089c4d77d2bb82963d531bb1d (diff) | |
download | gcc-b6d37ec1dd2a228d94e7b5b438f3aa53684316bc.zip gcc-b6d37ec1dd2a228d94e7b5b438f3aa53684316bc.tar.gz gcc-b6d37ec1dd2a228d94e7b5b438f3aa53684316bc.tar.bz2 |
c: Suppress -Wdeprecated-non-prototype warnings for builtins
Builtins defined with BT_FN_INT_VAR etc. show as functions without
a prototype and trigger the warning.
gcc/c/
PR c/119950
* c-typeck.cc (convert_arguments): Check for built-in
function declaration before warning.
gcc/testsuite/
* gcc.dg/Wdeprecated-non-prototype-5.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/c-typeck.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wdeprecated-non-prototype-5.c | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index d94ecb5..c7a13bf 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -4336,7 +4336,8 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree fntype, builtin_typetail = NULL_TREE; } - if (!typetail && parmnum == 0 && !TYPE_NO_NAMED_ARGS_STDARG_P (fntype)) + if (!typetail && parmnum == 0 && !TYPE_NO_NAMED_ARGS_STDARG_P (fntype) + && !fndecl_built_in_p (fundecl)) { auto_diagnostic_group d; bool warned; diff --git a/gcc/testsuite/gcc.dg/Wdeprecated-non-prototype-5.c b/gcc/testsuite/gcc.dg/Wdeprecated-non-prototype-5.c new file mode 100644 index 0000000..b231a74 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wdeprecated-non-prototype-5.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Wdeprecated-non-prototype" } */ + +static inline +int f (int x) +{ + return __builtin_constant_p (x); +} + +static inline +int g (double x) +{ + return __builtin_isfinite (x); +} |