On Tue, 7 Jun 2022, Martin Uecker wrote:

> here is a preliminary patch the implements the proposed
> tag compatibility rules for C23 in GCC (N2863). It works

I don't see any response on the reflector to my comments on that proposal 
(message 21374, Fri, 14 Jan 2022 23:32:47 +0000).  Nor do I see any tests 
in this patch dealing with the questions of exactly when struct and union 
types are complete or incomplete, as in my first comment there (if there 
are any tests concerning that, it's not apparent for lack of comments 
explaining what exactly the tests are trying to test).  I think we'll need 
a version of the proposal without known issues before the patch is fully 
reviewable.

> - the feature has a flag (-ftag-compat) which is now turned
> on by default in all language modes to facilitate testing
> and to identify backwards compatibility problems. Turned on,
> it survives bootstrapping and regression testing with
> only a few cases that test for diagnostics that go
> away changed to turn it off.

Turning on by default in past language modes seems questionable other than 
for this sort of preliminary testing (in any case, incompatible with 
previous standard requirements so can't be enabled for strict conformance 
modes).  (And in general I'd discourage adding options for individual 
language feature like that, with the resulting proliferation of dialects 
with different combinations of features - again, it may be useful for 
testing purposes, especially before we know whether the feature gets into 
C23, and it may be useful within the compiler sources to distinguish in 
some way which places are checking for this feature rather than just 
testing flag_isoc2x, but actually releasing with a command-line option for 
it is more problematic.)

> diff --git a/gcc/testsuite/gcc.dg/tag-compat2.c
> b/gcc/testsuite/gcc.dg/tag-compat2.c
> new file mode 100644
> index 00000000000..20dc1a9c894
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tag-compat2.c
> @@ -0,0 +1,47 @@
> +/*
> + * { dg-do compile }
> + * { dg-options "-ftag-compat" }
> + */
> +
> +typedef struct bar { int x; } X;
> +typedef struct bar { float x; } Y; /* { dg-warning "redefinition of
> struct or union" } */

I'd expect conflicting definitions of a type in the same scope to remain 
errors, not warnings, regardless of this feature.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to