* Allow array declarators to have 'restrict' in them
@ 2009-06-18 16:44 Linus Torvalds
2009-06-18 16:52 ` Turn off '-Wtransparent-union' by default Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2009-06-18 16:44 UTC (permalink / raw)
To: Christopher Li, linux-sparse
Otherwise sparse is very unhappy about the current glibc header files
(aio.h, netdb.h. regex.h and spawn.h at a minimum).
It's a hack, and not a proper parsing with saving the information. It just
ignores any "restrict" keyword at the start of an abstract array
declaration, but it's better than what we have now.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
ident-list.h | 1 +
parse.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/ident-list.h b/ident-list.h
index 29ddeca..0ee81bc 100644
--- a/ident-list.h
+++ b/ident-list.h
@@ -83,6 +83,7 @@ IDENT(stdcall); IDENT(__stdcall__);
IDENT(fastcall); IDENT(__fastcall__);
IDENT(dllimport); IDENT(__dllimport__);
IDENT(dllexport); IDENT(__dllexport__);
+IDENT(restrict); IDENT(__restrict);
/* Preprocessor idents. Direct use of __IDENT avoids mentioning the keyword
* itself by name, preventing these tokens from expanding when compiling
diff --git a/parse.c b/parse.c
index fbeebb0..df696e5 100644
--- a/parse.c
+++ b/parse.c
@@ -1431,6 +1431,8 @@ static struct token *abstract_array_declarator(struct token *token, struct symbo
{
struct expression *expr = NULL;
+ if (match_idents(token, &restrict_ident, &__restrict_ident, NULL))
+ token = token->next;
token = parse_expression(token, &expr);
sym->array_size = expr;
return token;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Turn off '-Wtransparent-union' by default
2009-06-18 16:44 Allow array declarators to have 'restrict' in them Linus Torvalds
@ 2009-06-18 16:52 ` Linus Torvalds
2009-06-18 17:41 ` Avoid "attribute 'warning': unknown attribute" warning Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2009-06-18 16:52 UTC (permalink / raw)
To: Christopher Li, linux-sparse
It's a very annoying warning, and it's about a sparse limitation rather
than a real feature, so don't do it by default.
Sure, our lack of transparent union support will then make us warn about
the magic calling convention hacks (eg you'll see warnings like
connect.c:240:39: warning: incorrect type in argument 2 (invalid types)
connect.c:240:39: expected union __CONST_SOCKADDR_ARG [usertype] __addr
connect.c:240:39: got struct sockaddr *ai_addr
but it still doesn't mean that we have to be so noisy about just seeing
those transparent unions. One annoying warning is not an argument for
doing _another_ annoying warning too (and the calling convention
warnings at least only happen if you actually use them, unlike the
transparent union warning that happens every time we see one, used or
not).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
lib.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib.c b/lib.c
index 2b8d21e..42affcd 100644
--- a/lib.c
+++ b/lib.c
@@ -206,7 +206,7 @@ int Wparen_string = 0;
int Wptr_subtraction_blows = 0;
int Wreturn_void = 0;
int Wshadow = 0;
-int Wtransparent_union = 1;
+int Wtransparent_union = 0;
int Wtypesign = 0;
int Wundef = 0;
int Wuninitialized = 1;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Avoid "attribute 'warning': unknown attribute" warning
2009-06-18 16:52 ` Turn off '-Wtransparent-union' by default Linus Torvalds
@ 2009-06-18 17:41 ` Linus Torvalds
0 siblings, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2009-06-18 17:41 UTC (permalink / raw)
To: Christopher Li, linux-sparse
This avoids getting annoying warnings from <curl/typecheck-gcc.h> and from
<bits/string3.h>, which use the "__attribute__((__warning__ (msg)))" gcc
attribute.
[ The attribute causes gcc to print out the supplied warning message if
the function is used. We should some day support it, but this patch just
makes us ignore it. ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
parse.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/parse.c b/parse.c
index df696e5..e5ad867 100644
--- a/parse.c
+++ b/parse.c
@@ -528,6 +528,8 @@ static struct init_keyword {
{ "__cold__", NS_KEYWORD, .op = &ignore_attr_op },
{ "hot", NS_KEYWORD, .op = &ignore_attr_op },
{ "__hot__", NS_KEYWORD, .op = &ignore_attr_op },
+ { "warning", NS_KEYWORD, .op = &ignore_attr_op },
+ { "__warning__", NS_KEYWORD, .op = &ignore_attr_op },
};
void init_parser(int stream)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-18 17:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 16:44 Allow array declarators to have 'restrict' in them Linus Torvalds
2009-06-18 16:52 ` Turn off '-Wtransparent-union' by default Linus Torvalds
2009-06-18 17:41 ` Avoid "attribute 'warning': unknown attribute" warning Linus Torvalds
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).