From: Oleg Nesterov <oleg@redhat.com>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Alexey Gladkov <gladkov.alexey@gmail.com>, linux-sparse@vger.kernel.org
Subject: Re: [PATCH] Add symantic index utility
Date: Wed, 11 Mar 2020 13:04:27 +0100 [thread overview]
Message-ID: <20200311120427.GB19327@redhat.com> (raw)
In-Reply-To: <20200310171202.y5rhsydmmbewoarm@ltop.local>
On 03/10, Luc Van Oostenryck wrote:
>
> Anyway, only a warning should be issued (I'll send a patch for this).
> I also wouldn't mind to add a new warning flag to suppress it,
> something like -Wno-directive-within-macro.
OK, agreed. something like below?
Oleg.
diff --git a/lib.c b/lib.c
index f15e4d99..264a890e 100644
--- a/lib.c
+++ b/lib.c
@@ -264,6 +264,7 @@ int Wdecl = 1;
int Wdeclarationafterstatement = -1;
int Wdefault_bitfield_sign = 0;
int Wdesignated_init = 1;
+int Wdirective_within_macro = 1;
int Wdo_while = 0;
int Wimplicit_int = 1;
int Winit_cstring = 0;
@@ -740,6 +741,7 @@ static const struct flag warnings[] = {
{ "declaration-after-statement", &Wdeclarationafterstatement },
{ "default-bitfield-sign", &Wdefault_bitfield_sign },
{ "designated-init", &Wdesignated_init },
+ { "directive-within-macro", &Wdirective_within_macro },
{ "do-while", &Wdo_while },
{ "enum-mismatch", &Wenum_mismatch },
{ "external-function-has-definition", &Wexternal_function_has_definition },
diff --git a/lib.h b/lib.h
index 72651cef..49db0117 100644
--- a/lib.h
+++ b/lib.h
@@ -153,6 +153,7 @@ extern int Wdecl;
extern int Wdeclarationafterstatement;
extern int Wdefault_bitfield_sign;
extern int Wdesignated_init;
+extern int Wdirective_within_macro;
extern int Wdo_while;
extern int Wenum_mismatch;
extern int Wexternal_function_has_definition;
diff --git a/pre-process.c b/pre-process.c
index 433d1bf8..e79a447a 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -271,8 +271,9 @@ static struct token *collect_arg(struct token *prev, int vararg, struct position
while (!eof_token(next = scan_next(p))) {
if (next->pos.newline && match_op(next, '#')) {
if (!next->pos.noexpand) {
- sparse_error(next->pos,
- "directive in macro's argument list");
+ if (Wdirective_within_macro)
+ warning(next->pos,
+ "directive in macro's argument list");
preprocessor_line(stream, p);
__free_token(next); /* Free the '#' token */
continue;
next prev parent reply other threads:[~2020-03-11 12:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 15:25 [PATCH] Add symantic index utility Alexey Gladkov
2020-03-09 22:37 ` Luc Van Oostenryck
2020-03-10 15:07 ` Oleg Nesterov
2020-03-10 17:12 ` Luc Van Oostenryck
2020-03-11 12:04 ` Oleg Nesterov [this message]
2020-03-11 16:47 ` Luc Van Oostenryck
2020-03-11 9:07 ` Dan Carpenter
2020-03-11 11:33 ` Oleg Nesterov
2020-03-11 17:11 ` Luc Van Oostenryck
2020-03-11 17:06 ` 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=20200311120427.GB19327@redhat.com \
--to=oleg@redhat.com \
--cc=gladkov.alexey@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
/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