linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 3/6] add testcases for C99 array declarators
Date: Fri, 24 Jul 2020 01:46:38 +0200	[thread overview]
Message-ID: <20200723234641.78462-4-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200723234641.78462-1-luc.vanoostenryck@gmail.com>

C99 introduced some funky new array declarators, those with
'restrict' or 'static' inside the brackets.

Add some testcases for them.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/abstract-array-declarator-quals.c | 22 ++++++++++++++++++++
 validation/abstract-array-declarator-star.c  |  9 ++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 validation/abstract-array-declarator-quals.c
 create mode 100644 validation/abstract-array-declarator-star.c

diff --git a/validation/abstract-array-declarator-quals.c b/validation/abstract-array-declarator-quals.c
new file mode 100644
index 000000000000..85a35a2aca7c
--- /dev/null
+++ b/validation/abstract-array-declarator-quals.c
@@ -0,0 +1,22 @@
+#define N 2
+
+void ok1(int []);
+void ok2(int [N]);
+void ok3(int [const volatile restrict]);
+void ok4(int [const volatile restrict N]);
+void ok5(int [static N]);
+void ok6(int [static const volatile restrict N]);
+void ok7(int [const volatile restrict static N]);
+
+void ok1(int a[]);
+void ok2(int a[N]);
+void ok3(int a[const volatile restrict]);
+void ok4(int a[const volatile restrict N]);
+void ok5(int a[static N]);
+void ok6(int a[static const volatile restrict N]);
+void ok7(int a[const volatile restrict static N]);
+
+/*
+ * check-name: abstract-array-declarator-quals
+ * check-known-to-fail
+ */
diff --git a/validation/abstract-array-declarator-star.c b/validation/abstract-array-declarator-star.c
new file mode 100644
index 000000000000..fdbdff19840d
--- /dev/null
+++ b/validation/abstract-array-declarator-star.c
@@ -0,0 +1,9 @@
+void ok8(int [*]);
+
+void ok8(int a[*]);
+void ok9(int a[const volatile restrict *]);
+
+/*
+ * check-name: abstract-array-declarator-star
+ * check-known-to-fail
+ */
-- 
2.27.0


  parent reply	other threads:[~2020-07-23 23:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 23:46 [PATCH 0/6] fix parsing of C99's array declarators Luc Van Oostenryck
2020-07-23 23:46 ` [PATCH 1/6] add testcase for comma in array declarator Luc Van Oostenryck
2020-07-23 23:46 ` [PATCH 2/6] do not accept comma expressions " Luc Van Oostenryck
2020-07-23 23:46 ` Luc Van Oostenryck [this message]
2020-07-23 23:46 ` [PATCH 4/6] simplify & fix parsing of array declarators Luc Van Oostenryck
2020-07-23 23:46 ` [PATCH 5/6] remove now unused match_idents() Luc Van Oostenryck
2020-07-23 23:46 ` [PATCH 6/6] allow [*] in array declarators Luc Van Oostenryck

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=20200723234641.78462-4-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.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 NNTP newsgroup(s).