public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: "Uecker, Martin" <Martin.Uecker@med.uni-goettingen.de>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C PATCH] qualifiers of pointers to arrays in C2X [PR 98397]
Date: Fri, 1 Jan 2021 00:01:29 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2012312356140.929441@digraph.polyomino.org.uk> (raw)
In-Reply-To: <1608546487.5427.1.camel@med.uni-goettingen.de>

On Mon, 21 Dec 2020, Uecker, Martin wrote:

> diff --git a/gcc/testsuite/gcc.dg/c2x-qual-1.c b/gcc/testsuite/gcc.dg/c2x-qual-1.c
> new file mode 100644
> index 00000000000..058a840e04c
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/c2x-qual-1.c
> @@ -0,0 +1,12 @@
> +/* Test that qualifiers are not lost in tertiary operator for pointers to arrays, PR98397 */
> +/* { dg-do compile } */
> +/* { dg-options "-std=gnu2x" } */
> +
> +void foo(void)
> +{
> +	const int (*u)[1];
> +	void *v;
> +	extern const void *vc;
> +	extern typeof(1 ? u : v) vc;
> +	extern typeof(1 ? v : u) vc;
> +}

I'd expect c2x-* tests to use -std=c2x not -std=gnu2x.  Tests needing 
-std=gnu2x can be gnu2x-* tests, but you should be able to test the types 
using _Generic without needing any gnu2x features.  c2x-* tests should 
also use -pedantic or -pedantic-errors unless they are specifically 
testing something that doesn't work with those options.

There should also be tests for cases where code is valid before C2x but 
invalid in C2x (assignment storing a pointer-to-qualified-array in void *, 
for example).

All the tests should have both c2x-* and c11-* variants so the testsuite 
verifies that the code is properly handled in C11 mode (warnings with 
-pedantic, errors with -pedantic-errors, in the cases that are invalid for 
C11 but valid for C2x).  There should also be -Wc11-c2x-compat tests with 
-std=c2x where appropriate.

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2021-01-01  0:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 10:28 Uecker, Martin
2021-01-01  0:01 ` Joseph Myers [this message]
2021-01-17 20:18   ` Uecker, Martin
2021-01-18 21:48     ` Joseph Myers
2021-05-24  6:05 Uecker, Martin
2021-06-11 19:25 ` Uecker, Martin
2021-08-12 16:58 ` Joseph Myers
2021-08-22 22:20   ` Uecker, Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2012312356140.929441@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=Martin.Uecker@med.uni-goettingen.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).