diff mbox

[1/3] Warn on unknown attributes instead of throwing errors

Message ID 20161102215939.36765-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Luc Van Oostenryck Nov. 2, 2016, 9:59 p.m. UTC
GCC creates new attributes quite often, generaly for specific
usages irrelevant to what sparse is used for.
Throwing errors on these create needless noise and annoyance
which is better to avoid.


Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 parse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ramsay Jones Nov. 2, 2016, 10:29 p.m. UTC | #1
On 02/11/16 21:59, Luc Van Oostenryck wrote:
> GCC creates new attributes quite often, generaly for specific
> usages irrelevant to what sparse is used for.
> Throwing errors on these create needless noise and annoyance
> which is better to avoid.
> 
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  parse.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/parse.c b/parse.c
> index 205e1264..212fae3a 100644
> --- a/parse.c
> +++ b/parse.c
> @@ -1230,7 +1230,8 @@ static struct token *recover_unknown_attribute(struct token *token)
>  {
>  	struct expression *expr = NULL;
>  
> -	sparse_error(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident));
> +	if (Wunknown_attribute)

Since Wunknown_attribute is not declared yet, this won't even compile.
Simply squash this into patch #2.

Apart from that, looks good.

Thanks!

ATB,
Ramsay Jones
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Nov. 2, 2016, 11:09 p.m. UTC | #2
On Wed, Nov 02, 2016 at 10:29:41PM +0000, Ramsay Jones wrote:
> 
> 
> On 02/11/16 21:59, Luc Van Oostenryck wrote:
> > GCC creates new attributes quite often, generaly for specific
> > usages irrelevant to what sparse is used for.
> > Throwing errors on these create needless noise and annoyance
> > which is better to avoid.
> > 
> > 
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> > ---
> >  parse.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/parse.c b/parse.c
> > index 205e1264..212fae3a 100644
> > --- a/parse.c
> > +++ b/parse.c
> > @@ -1230,7 +1230,8 @@ static struct token *recover_unknown_attribute(struct token *token)
> >  {
> >  	struct expression *expr = NULL;
> >  
> > -	sparse_error(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident));
> > +	if (Wunknown_attribute)
> 
> Since Wunknown_attribute is not declared yet, this won't even compile.
> Simply squash this into patch #2.
> 
> Apart from that, looks good.
> 
> Thanks!
> 
> ATB,
> Ramsay Jones
> --

Grrr yes.
A leftover of the patch splitting. Sorry for that.

Thanks for noticing that.

Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/parse.c b/parse.c
index 205e1264..212fae3a 100644
--- a/parse.c
+++ b/parse.c
@@ -1230,7 +1230,8 @@  static struct token *recover_unknown_attribute(struct token *token)
 {
 	struct expression *expr = NULL;
 
-	sparse_error(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident));
+	if (Wunknown_attribute)
+		warning(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident));
 	token = token->next;
 	if (match_op(token, '('))
 		token = parens_expression(token, &expr, "in attribute");