* [PATCH] Recognize and ignore __alias__ and __visibility__
@ 2006-08-13 5:51 Pavel Roskin
2006-08-14 15:52 ` Josh Triplett
2006-09-11 21:09 ` [PATCH RESEND] " Josh Triplett
0 siblings, 2 replies; 4+ messages in thread
From: Pavel Roskin @ 2006-08-13 5:51 UTC (permalink / raw)
To: linux-sparse
From: Pavel Roskin <proski@gnu.org>
They are equivalent to "alias" and "visibility" except that gcc won't
complain about them in ANSI programs.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
ident-list.h | 4 ++--
parse.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ident-list.h b/ident-list.h
index 95bb96a..ecdce6d 100644
--- a/ident-list.h
+++ b/ident-list.h
@@ -56,8 +56,8 @@ IDENT(__const); IDENT(__const__); IDENT(
IDENT(__noreturn__); IDENT(regparm); IDENT(weak); IDENT(__weak__);
IDENT(__no_instrument_function__); IDENT(no_instrument_function);
IDENT(__sentinel__); IDENT(sentinel);
-IDENT(alias); IDENT(pure); IDENT(always_inline);
-IDENT(syscall_linkage); IDENT(visibility);
+IDENT(alias); IDENT(__alias__); IDENT(pure); IDENT(always_inline);
+IDENT(syscall_linkage); IDENT(visibility); IDENT(__visibility__);
IDENT(bitwise); IDENT(__bitwise__);
IDENT(model); IDENT(__model__);
IDENT(__format_arg__);
diff --git a/parse.c b/parse.c
index c536ec2..1c9aab8 100644
--- a/parse.c
+++ b/parse.c
@@ -530,6 +530,8 @@ static const char * handle_attribute(str
return NULL;
if (attribute == &alias_ident)
return NULL;
+ if (attribute == &__alias___ident)
+ return NULL;
if (attribute == &pure_ident ||
attribute == &__pure___ident)
return NULL;
@@ -539,6 +541,8 @@ static const char * handle_attribute(str
return NULL;
if (attribute == &visibility_ident)
return NULL;
+ if (attribute == &__visibility___ident)
+ return NULL;
if (attribute == &deprecated_ident ||
attribute == &__deprecated___ident)
return NULL;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Recognize and ignore __alias__ and __visibility__
2006-08-13 5:51 [PATCH] Recognize and ignore __alias__ and __visibility__ Pavel Roskin
@ 2006-08-14 15:52 ` Josh Triplett
2006-08-14 19:25 ` Pavel Roskin
2006-09-11 21:09 ` [PATCH RESEND] " Josh Triplett
1 sibling, 1 reply; 4+ messages in thread
From: Josh Triplett @ 2006-08-14 15:52 UTC (permalink / raw)
To: Pavel Roskin; +Cc: linux-sparse
On Sun, 2006-08-13 at 01:51 -0400, Pavel Roskin wrote:
> diff --git a/parse.c b/parse.c
> index c536ec2..1c9aab8 100644
> --- a/parse.c
> +++ b/parse.c
> @@ -530,6 +530,8 @@ static const char * handle_attribute(str
> return NULL;
> if (attribute == &alias_ident)
> return NULL;
> + if (attribute == &__alias___ident)
> + return NULL;
> if (attribute == &pure_ident ||
> attribute == &__pure___ident)
> return NULL;
> @@ -539,6 +541,8 @@ static const char * handle_attribute(str
> return NULL;
> if (attribute == &visibility_ident)
> return NULL;
> + if (attribute == &__visibility___ident)
> + return NULL;
> if (attribute == &deprecated_ident ||
> attribute == &__deprecated___ident)
> return NULL;
Stylistically, it looks like all of the existing ignored keywords in
this function use a single combined if condition for the underscored and
non-underscored versions of a given keyword, rather than two separate if
conditions. For consistency, what about something like the following
instead:
diff --git a/ident-list.h b/ident-list.h
index 95bb96a..ecdce6d 100644
--- a/ident-list.h
+++ b/ident-list.h
@@ -56,8 +56,8 @@ IDENT(__const); IDENT(__const__); IDENT(
IDENT(__noreturn__); IDENT(regparm); IDENT(weak); IDENT(__weak__);
IDENT(__no_instrument_function__); IDENT(no_instrument_function);
IDENT(__sentinel__); IDENT(sentinel);
-IDENT(alias); IDENT(pure); IDENT(always_inline);
-IDENT(syscall_linkage); IDENT(visibility);
+IDENT(alias); IDENT(__alias__); IDENT(pure); IDENT(always_inline);
+IDENT(syscall_linkage); IDENT(visibility); IDENT(__visibility__);
IDENT(bitwise); IDENT(__bitwise__);
IDENT(model); IDENT(__model__);
IDENT(__format_arg__);
diff --git a/parse.c b/parse.c
index c536ec2..6857541 100644
--- a/parse.c
+++ b/parse.c
@@ -528,7 +528,8 @@ static const char * handle_attribute(str
if (attribute == &weak_ident ||
attribute == &__weak___ident)
return NULL;
- if (attribute == &alias_ident)
+ if (attribute == &alias_ident ||
+ attribute == &__alias___ident)
return NULL;
if (attribute == &pure_ident ||
attribute == &__pure___ident)
@@ -537,7 +538,8 @@ static const char * handle_attribute(str
return NULL;
if (attribute == &syscall_linkage_ident)
return NULL;
- if (attribute == &visibility_ident)
+ if (attribute == &visibility_ident ||
+ attribute == &__visibility___ident)
return NULL;
if (attribute == &deprecated_ident ||
attribute == &__deprecated___ident)
- Josh Triplett
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Recognize and ignore __alias__ and __visibility__
2006-08-14 15:52 ` Josh Triplett
@ 2006-08-14 19:25 ` Pavel Roskin
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Roskin @ 2006-08-14 19:25 UTC (permalink / raw)
To: Josh Triplett; +Cc: linux-sparse
On Mon, 2006-08-14 at 08:52 -0700, Josh Triplett wrote:
> Stylistically, it looks like all of the existing ignored keywords in
> this function use a single combined if condition for the underscored and
> non-underscored versions of a given keyword, rather than two separate if
> conditions. For consistency, what about something like the following
> instead:
Thanks for this improvement!
Signed-off-by: Pavel Roskin <proski@gnu.org>
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RESEND] Recognize and ignore __alias__ and __visibility__
2006-08-13 5:51 [PATCH] Recognize and ignore __alias__ and __visibility__ Pavel Roskin
2006-08-14 15:52 ` Josh Triplett
@ 2006-09-11 21:09 ` Josh Triplett
1 sibling, 0 replies; 4+ messages in thread
From: Josh Triplett @ 2006-09-11 21:09 UTC (permalink / raw)
To: linux-sparse; +Cc: Pavel Roskin, Linus Torvalds
Sparse currently parses and ignores the alias and visibility attributes,
but not the variants __alias__ and __visibility__, which GCC permits
even in ANSI C to allow for use in headers. Add support for these
variants.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
Original patch by Pavel Roskin; modified version with consolidated if
statements by me, with signoff from Pavel.
parse.c | 6 ++++--
ident-list.h | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/ident-list.h b/ident-list.h
index 95bb96a..ecdce6d 100644
--- a/ident-list.h
+++ b/ident-list.h
@@ -56,8 +56,8 @@ IDENT(__const); IDENT(__const__); IDENT(
IDENT(__noreturn__); IDENT(regparm); IDENT(weak); IDENT(__weak__);
IDENT(__no_instrument_function__); IDENT(no_instrument_function);
IDENT(__sentinel__); IDENT(sentinel);
-IDENT(alias); IDENT(pure); IDENT(always_inline);
-IDENT(syscall_linkage); IDENT(visibility);
+IDENT(alias); IDENT(__alias__); IDENT(pure); IDENT(always_inline);
+IDENT(syscall_linkage); IDENT(visibility); IDENT(__visibility__);
IDENT(bitwise); IDENT(__bitwise__);
IDENT(model); IDENT(__model__);
IDENT(__format_arg__);
diff --git a/parse.c b/parse.c
index c536ec2..6857541 100644
--- a/parse.c
+++ b/parse.c
@@ -528,7 +528,8 @@ static const char * handle_attribute(str
if (attribute == &weak_ident ||
attribute == &__weak___ident)
return NULL;
- if (attribute == &alias_ident)
+ if (attribute == &alias_ident ||
+ attribute == &__alias___ident)
return NULL;
if (attribute == &pure_ident ||
attribute == &__pure___ident)
@@ -537,7 +538,8 @@ static const char * handle_attribute(str
return NULL;
if (attribute == &syscall_linkage_ident)
return NULL;
- if (attribute == &visibility_ident)
+ if (attribute == &visibility_ident ||
+ attribute == &__visibility___ident)
return NULL;
if (attribute == &deprecated_ident ||
attribute == &__deprecated___ident)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-11 21:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-13 5:51 [PATCH] Recognize and ignore __alias__ and __visibility__ Pavel Roskin
2006-08-14 15:52 ` Josh Triplett
2006-08-14 19:25 ` Pavel Roskin
2006-09-11 21:09 ` [PATCH RESEND] " Josh Triplett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox