aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2022-03-09 22:51:23 +0000
committerJoseph Myers <joseph@codesourcery.com>2022-03-09 22:51:23 +0000
commit4ea128d5c740e4e8c2e7b70de3a90435035eb863 (patch)
tree5356ddd0d816b830310838a30c3ec5d359d93899 /gcc/c
parent22015e77d3e45306077396b9de8a8a28bb67fb20 (diff)
downloadgcc-4ea128d5c740e4e8c2e7b70de3a90435035eb863.zip
gcc-4ea128d5c740e4e8c2e7b70de3a90435035eb863.tar.gz
gcc-4ea128d5c740e4e8c2e7b70de3a90435035eb863.tar.bz2
c: Revert C2x changes to function type compatibility
In commit cc806126215c3f4dc187eff3bf923458d8cc6b4f, I implemented changes that C2x had made to compatibility of unprototyped and prototyped function types. C2x has since completely removed unprototyped function types, making () in a function declaration mean (void) as in C++. While that change isn't appropriate at the current development stage for GCC 12, it does mean that it doesn't make sense for GCC 12 to have different rules for unprototyped functions in C2x mode than in other modes or previous and subsequent GCC versions. Thus, revert the previous change to avoid it getting into a GCC release, and update the corresponding tests to expect the same behavior with -std=c2x as with -std=c11 (they will of course need to change again after implementing () as meaning (void)). Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-typeck.cc (function_types_compatible_p): Do not handle C2X differently from earlier standards for unprototyped function type compatibility. gcc/testsuite/ * gcc.dg/c11-unproto-1.c, gcc.dg/c11-unproto-2.c: Update comments. * gcc.dg/c2x-unproto-1.c, gcc.dg/c2x-unproto-2.c: Expect same results as in C11 mode. Update comments.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-typeck.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index b37f3cf..54b0b0d 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -1693,7 +1693,7 @@ function_types_compatible_p (const_tree f1, const_tree f2,
if (args1 == NULL_TREE)
{
- if (flag_isoc2x ? stdarg_p (f2) : !self_promoting_args_p (args2))
+ if (!self_promoting_args_p (args2))
return 0;
/* If one of these types comes from a non-prototype fn definition,
compare that with the other type's arglist.
@@ -1706,7 +1706,7 @@ function_types_compatible_p (const_tree f1, const_tree f2,
}
if (args2 == NULL_TREE)
{
- if (flag_isoc2x ? stdarg_p (f1) : !self_promoting_args_p (args1))
+ if (!self_promoting_args_p (args1))
return 0;
if (TYPE_ACTUAL_ARG_TYPES (f2)
&& type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2),