diff options
author | Oleg Nesterov <oleg@redhat.com> | 2020-03-12 16:09:09 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-03-15 23:25:15 +0100 |
commit | 0e3729b3edb8d3f384c907127f664e38bd7adab8 (patch) | |
tree | 68669727132a336d45ba0fd2c4158969f2428907 | |
parent | bc544c461c14915c55b2dd240dd5d15df4f4d8ea (diff) | |
download | sparse-0e3729b3edb8d3f384c907127f664e38bd7adab8.tar.gz |
make "directive in macro's argument list" a warning
The presence of preprocessor directives within the arguments
of a macro invocation is Undefined Behaviour [6.10.3p11].
Sparse issues an error for this but most often the result is
well defined and is not a problem, processing can continue
(for example, when the directive is one of the conditional ones).
So, downgrade this sparse_error() to warning() (especially
because issuing an error message can hide those coming later).
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | pre-process.c | 2 | ||||
-rw-r--r-- | validation/preprocessor/preprocessor22.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pre-process.c b/pre-process.c index 7b245a04..82bfa402 100644 --- a/pre-process.c +++ b/pre-process.c @@ -271,7 +271,7 @@ 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, + warning(next->pos, "directive in macro's argument list"); preprocessor_line(stream, p); __free_token(next); /* Free the '#' token */ diff --git a/validation/preprocessor/preprocessor22.c b/validation/preprocessor/preprocessor22.c index fb28daaa..277334c6 100644 --- a/validation/preprocessor/preprocessor22.c +++ b/validation/preprocessor/preprocessor22.c @@ -20,10 +20,10 @@ define_struct(a, { * check-command: sparse -E $file * * check-error-start -preprocessor/preprocessor22.c:6:1: error: directive in macro's argument list -preprocessor/preprocessor22.c:8:1: error: directive in macro's argument list -preprocessor/preprocessor22.c:10:1: error: directive in macro's argument list -preprocessor/preprocessor22.c:12:1: error: directive in macro's argument list +preprocessor/preprocessor22.c:6:1: warning: directive in macro's argument list +preprocessor/preprocessor22.c:8:1: warning: directive in macro's argument list +preprocessor/preprocessor22.c:10:1: warning: directive in macro's argument list +preprocessor/preprocessor22.c:12:1: warning: directive in macro's argument list * check-error-end * * check-output-start |