cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Cocci] [PATCH v2 3/3] tests: Add test case for <macro> bool <ident>
Date: Tue, 21 Jan 2020 13:34:55 +0530	[thread overview]
Message-ID: <20200121080455.24748-4-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200121080455.24748-1-jaskaransingh7654321@gmail.com>

This would previously yield pretty printing errors,
i.e. bool would be printed on the next line, followed by ret on
the next to next line.

The metatype should be only bool and not <macro> bool.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
 tests/macro_before_bool.c     | 4 ++++
 tests/macro_before_bool.cocci | 9 +++++++++
 tests/macro_before_bool.res   | 5 +++++
 3 files changed, 18 insertions(+)
 create mode 100644 tests/macro_before_bool.c
 create mode 100644 tests/macro_before_bool.cocci
 create mode 100644 tests/macro_before_bool.res

diff --git a/tests/macro_before_bool.c b/tests/macro_before_bool.c
new file mode 100644
index 00000000..a59cba5a
--- /dev/null
+++ b/tests/macro_before_bool.c
@@ -0,0 +1,4 @@
+static nokprobe_inline bool trace_kprobe_is_return(struct trace_kprobe *tk)
+{
+	return false;
+}
diff --git a/tests/macro_before_bool.cocci b/tests/macro_before_bool.cocci
new file mode 100644
index 00000000..53b2fd2e
--- /dev/null
+++ b/tests/macro_before_bool.cocci
@@ -0,0 +1,9 @@
+@@
+type t;
+identifier x;
+@@
+
+t x(...) {
++	t ret;
+	return false;
+}
diff --git a/tests/macro_before_bool.res b/tests/macro_before_bool.res
new file mode 100644
index 00000000..1b0ec319
--- /dev/null
+++ b/tests/macro_before_bool.res
@@ -0,0 +1,5 @@
+static nokprobe_inline bool trace_kprobe_is_return(struct trace_kprobe *tk)
+{
+	bool ret;
+	return false;
+}
-- 
2.21.1

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  parent reply	other threads:[~2020-01-21  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21  8:04 [Cocci] [PATCH v2 0/3] cocci: Improve management of macros before typedefs Jaskaran Singh
2020-01-21  8:04 ` [Cocci] [PATCH v2 1/3] parsing_c: Handle case of macro before typedef Jaskaran Singh
2020-01-21  8:04 ` [Cocci] [PATCH v2 2/3] parsing_hacks: Add bool to list of known typedefs Jaskaran Singh
2020-01-21  8:04 ` Jaskaran Singh [this message]
2020-01-21 12:24 ` [Cocci] [PATCH v3 0/3] cocci: Improve management of macros before typedefs Jaskaran Singh
2020-01-25 15:01   ` Julia Lawall
2020-01-21 12:27 ` [Cocci] [PATCH v3 1/3] parsing_c: Handle case of macro before typedef Jaskaran Singh
2020-01-21 12:27   ` [Cocci] [PATCH v3 2/3] parsing_hacks: Add bool to list of known typedefs Jaskaran Singh
2020-01-21 12:27   ` [Cocci] [PATCH v3 3/3] tests: Add test case for <macro> bool <ident> Jaskaran Singh
2020-01-21 10:22 [Cocci] [PATCH v2 " Markus Elfring

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=20200121080455.24748-4-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=linux-kernel-mentees@lists.linuxfoundation.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).