From: Pavel Roskin <proski@gnu.org>
To: linux-sparse@vger.kernel.org
Subject: [RFC PATCH] Make "bad constant expression" a warning, not an error
Date: Fri, 20 Jun 2008 11:08:28 -0400 [thread overview]
Message-ID: <1213974508.18379.2.camel@dv> (raw)
Do the same to "bad integer constant expression". It's still possible
to continue parsing the code if those are not constant. To be on the
safe side, assume the actual value to be the largest value for the
type.
---
expand.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/expand.c b/expand.c
index 032f0c5..12a8989 100644
--- a/expand.c
+++ b/expand.c
@@ -1201,18 +1201,20 @@ static long long __get_expression_value(struct expression *expr, int strict)
expression_error(expr, "bad constant expression type");
return 0;
}
+
+ mask = 1ULL << (ctype->bit_size-1);
+
expand_expression(expr);
if (expr->type != EXPR_VALUE) {
- expression_error(expr, "bad constant expression");
- return 0;
+ warning(expr->pos, "bad constant expression");
+ return mask;
}
if (strict && bad_integer_constant_expression(expr)) {
- expression_error(expr, "bad integer constant expression");
- return 0;
+ warning(expr->pos, "bad integer constant expression");
+ return mask;
}
value = expr->value;
- mask = 1ULL << (ctype->bit_size-1);
if (value & mask) {
while (ctype->type != SYM_BASETYPE)
--
Regards,
Pavel Roskin
next reply other threads:[~2008-06-20 15:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-20 15:08 Pavel Roskin [this message]
2008-06-20 22:52 ` [RFC PATCH] Make "bad constant expression" a warning, not an error Christopher Li
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=1213974508.18379.2.camel@dv \
--to=proski@gnu.org \
--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).