From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 2/3] Add a new warning flag: '-Wunknown-attribute'
Date: Wed, 2 Nov 2016 22:59:38 +0100 [thread overview]
Message-ID: <20161102215939.36765-3-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20161102215939.36765-1-luc.vanoostenryck@gmail.com>
So, we can choose if we're interested by those warnings or not.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
lib.c | 2 ++
lib.h | 1 +
validation/Wunknown-attribute-def.c | 9 +++++++++
validation/Wunknown-attribute-no.c | 9 +++++++++
validation/Wunknown-attribute-yes.c | 10 ++++++++++
5 files changed, 31 insertions(+)
create mode 100644 validation/Wunknown-attribute-def.c
create mode 100644 validation/Wunknown-attribute-no.c
create mode 100644 validation/Wunknown-attribute-yes.c
diff --git a/lib.c b/lib.c
index d5b56b01..138736e7 100644
--- a/lib.c
+++ b/lib.c
@@ -240,6 +240,7 @@ int Wtransparent_union = 0;
int Wtypesign = 0;
int Wundef = 0;
int Wuninitialized = 1;
+int Wunknown_attribute = 1;
int Wvla = 1;
int dbg_entry = 0;
@@ -463,6 +464,7 @@ static const struct warning {
{ "typesign", &Wtypesign },
{ "undef", &Wundef },
{ "uninitialized", &Wuninitialized },
+ { "unknown-attribute", &Wunknown_attribute },
{ "vla", &Wvla },
};
diff --git a/lib.h b/lib.h
index 15b69fa2..b778bdcd 100644
--- a/lib.h
+++ b/lib.h
@@ -126,6 +126,7 @@ extern int Wtransparent_union;
extern int Wtypesign;
extern int Wundef;
extern int Wuninitialized;
+extern int Wunknown_attribute;
extern int Wvla;
extern int dbg_entry;
diff --git a/validation/Wunknown-attribute-def.c b/validation/Wunknown-attribute-def.c
new file mode 100644
index 00000000..0c0868d6
--- /dev/null
+++ b/validation/Wunknown-attribute-def.c
@@ -0,0 +1,9 @@
+static int foo(void) __attribute__((unknown_attribute));
+
+/*
+ * check-name: warn-unknown-attribute
+ *
+ * check-error-start
+Wunknown-attribute-def.c:1:37: warning: attribute 'unknown_attribute': unknown attribute
+ * check-error-end
+ */
diff --git a/validation/Wunknown-attribute-no.c b/validation/Wunknown-attribute-no.c
new file mode 100644
index 00000000..87951699
--- /dev/null
+++ b/validation/Wunknown-attribute-no.c
@@ -0,0 +1,9 @@
+static int foo(void) __attribute__((unknown_attribute));
+
+/*
+ * check-name: warn-unknown-attribute-no
+ * check-command: sparse -Wno-unknown-attribute $file
+ *
+ * check-error-start
+ * check-error-end
+ */
diff --git a/validation/Wunknown-attribute-yes.c b/validation/Wunknown-attribute-yes.c
new file mode 100644
index 00000000..72538cf5
--- /dev/null
+++ b/validation/Wunknown-attribute-yes.c
@@ -0,0 +1,10 @@
+static int foo(void) __attribute__((unknown_attribute));
+
+/*
+ * check-name: warn-unknown-attribute-yes
+ * check-command: sparse -Wunknown-attribute $file
+ *
+ * check-error-start
+Wunknown-attribute-yes.c:1:37: warning: attribute 'unknown_attribute': unknown attribute
+ * check-error-end
+ */
--
2.10.1
next prev parent reply other threads:[~2016-11-02 22:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 21:59 [PATCH 0/3] reduce noise from unknown attributes Luc Van Oostenryck
2016-11-02 21:59 ` [PATCH 1/3] Warn on unknown attributes instead of throwing errors Luc Van Oostenryck
2016-11-02 22:29 ` Ramsay Jones
2016-11-02 23:09 ` Luc Van Oostenryck
2016-11-02 21:59 ` Luc Van Oostenryck [this message]
2016-11-02 21:59 ` [PATCH 3/3] By default disable '-Wunknown-attribute' Luc Van Oostenryck
2016-11-17 16:52 ` Christopher Li
2016-11-17 18:04 ` 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=20161102215939.36765-3-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.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).