* Ignore the ms_abi/sysv_abi attributes.
@ 2009-09-29 21:01 Michael Stefaniuc
2009-09-29 23:30 ` Christopher Li
0 siblings, 1 reply; 4+ messages in thread
From: Michael Stefaniuc @ 2009-09-29 21:01 UTC (permalink / raw)
To: linux-sparse
This is needed for getting a meaningful sparse run on a Wine 64-bit
compile. Else the basic Win32 headers will produce tons of
error: attribute 'ms_abi': unknown attribute
which end in
error: too many errors.
The sysv_abi attribute was just added for symmetry.
Signed-off-by: Michael Stefaniuc <mstefani@redhat.com>
---
parse.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/parse.c b/parse.c
index 5e75242..5f6f9c3 100644
--- a/parse.c
+++ b/parse.c
@@ -525,6 +525,10 @@ static struct init_keyword {
{ "__stdcall__", NS_KEYWORD, .op = &ignore_attr_op },
{ "fastcall", NS_KEYWORD, .op = &ignore_attr_op },
{ "__fastcall__", NS_KEYWORD, .op = &ignore_attr_op },
+ { "ms_abi", NS_KEYWORD, .op = &ignore_attr_op },
+ { "__ms_abi__", NS_KEYWORD, .op = &ignore_attr_op },
+ { "sysv_abi", NS_KEYWORD, .op = &ignore_attr_op },
+ { "__sysv_abi__", NS_KEYWORD, .op = &ignore_attr_op },
{ "dllimport", NS_KEYWORD, .op = &ignore_attr_op },
{ "__dllimport__", NS_KEYWORD, .op = &ignore_attr_op },
{ "dllexport", NS_KEYWORD, .op = &ignore_attr_op },
--
1.6.5.rc1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Ignore the ms_abi/sysv_abi attributes.
2009-09-29 21:01 Ignore the ms_abi/sysv_abi attributes Michael Stefaniuc
@ 2009-09-29 23:30 ` Christopher Li
2009-09-30 20:21 ` Michael Stefaniuc
0 siblings, 1 reply; 4+ messages in thread
From: Christopher Li @ 2009-09-29 23:30 UTC (permalink / raw)
To: Michael Stefaniuc; +Cc: linux-sparse
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
On Tue, Sep 29, 2009 at 2:01 PM, Michael Stefaniuc <mstefani@redhat.com> wrote:
> This is needed for getting a meaningful sparse run on a Wine 64-bit
> compile. Else the basic Win32 headers will produce tons of
> error: attribute 'ms_abi': unknown attribute
> which end in
> error: too many errors.
>
> The sysv_abi attribute was just added for symmetry.
Thanks for the patch. Ignoring the attribute has become so common now.
I decide stop the complicate way to adding ignored attributes.
I attach two patches to simplify things. I am I am going to push
them out to chrisl tree.
Can you change your patch base on my new patch?
It should be really simple, just add one string for each attribute
is good enough.
Thanks!
Chris
[-- Attachment #2: 0001-Move-noreturn-attribute-out-of-ignore-attr-area.patch --]
[-- Type: application/octet-stream, Size: 1419 bytes --]
From b0baf9ed31ef756734331cf9b8a9ab377e93d316 Mon Sep 17 00:00:00 2001
From: Christopher Li <sparse@chrisli.org>
Date: Tue, 29 Sep 2009 14:58:48 -0700
Subject: [PATCH] Move noreturn attribute out of ignore attr area
Signed-off-by: Christopher Li <sparse@chrisli.org>
---
parse.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/parse.c b/parse.c
index 90403d8..b3bf15d 100644
--- a/parse.c
+++ b/parse.c
@@ -454,6 +454,8 @@ static struct init_keyword {
{ "mode", NS_KEYWORD, .op = &mode_op },
{ "context", NS_KEYWORD, .op = &context_op },
{ "__transparent_union__", NS_KEYWORD, .op = &transparent_union_op },
+ { "noreturn", NS_KEYWORD, MOD_NORETURN, .op = &attr_mod_op },
+ { "__noreturn__", NS_KEYWORD, MOD_NORETURN, .op = &attr_mod_op },
{ "__mode__", NS_KEYWORD, .op = &mode_op },
{ "QI", NS_KEYWORD, MOD_CHAR, .op = &mode_QI_op },
@@ -489,8 +491,6 @@ static struct init_keyword {
{ "const", NS_KEYWORD, .op = &ignore_attr_op },
{ "__const", NS_KEYWORD, .op = &ignore_attr_op },
{ "__const__", NS_KEYWORD, .op = &ignore_attr_op },
- { "noreturn", NS_KEYWORD, MOD_NORETURN, .op = &attr_mod_op },
- { "__noreturn__", NS_KEYWORD, MOD_NORETURN, .op = &attr_mod_op },
{ "no_instrument_function", NS_KEYWORD, .op = &ignore_attr_op },
{ "__no_instrument_function__", NS_KEYWORD, .op = &ignore_attr_op },
{ "sentinel", NS_KEYWORD, .op = &ignore_attr_op },
--
1.6.0.6
[-- Attachment #3: 0002-Declare-ignored-attributres-into-a-list-of-string.patch --]
[-- Type: application/octet-stream, Size: 6973 bytes --]
From dc9f14bd8cca5023f3ea07f2f3969737d9448c6a Mon Sep 17 00:00:00 2001
From: Christopher Li <sparse@chrisli.org>
Date: Tue, 29 Sep 2009 16:17:23 -0700
Subject: [PATCH] Declare ignored attributres into a list of string.
Adding ignored attributes is much easier now.
Signed-off-by: Christopher Li <sparse@chrisli.org>
---
lib.h | 4 ++
parse.c | 153 ++++++++++++++++++++++++++++++++++-----------------------------
2 files changed, 86 insertions(+), 71 deletions(-)
diff --git a/lib.h b/lib.h
index 25abb80..e19973f 100644
--- a/lib.h
+++ b/lib.h
@@ -20,6 +20,10 @@
#define DO_STRINGIFY(x) #x
#define STRINGIFY(x) DO_STRINGIFY(x)
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
+#endif
+
extern int verbose, optimize, optimize_size, preprocessing;
extern int die_if_error;
extern int repeat_phase, merge_phi_sources;
diff --git a/parse.c b/parse.c
index b3bf15d..34fa562 100644
--- a/parse.c
+++ b/parse.c
@@ -470,83 +470,85 @@ static struct init_keyword {
{ "__TI__", NS_KEYWORD, MOD_LONGLONGLONG, .op = &mode_TI_op },
{ "word", NS_KEYWORD, MOD_LONG, .op = &mode_word_op },
{ "__word__", NS_KEYWORD, MOD_LONG, .op = &mode_word_op },
+};
- /* Ignored attributes */
- { "nothrow", NS_KEYWORD, .op = &ignore_attr_op },
- { "__nothrow", NS_KEYWORD, .op = &ignore_attr_op },
- { "__nothrow__", NS_KEYWORD, .op = &ignore_attr_op },
- { "malloc", NS_KEYWORD, .op = &ignore_attr_op },
- { "__malloc__", NS_KEYWORD, .op = &ignore_attr_op },
- { "nonnull", NS_KEYWORD, .op = &ignore_attr_op },
- { "__nonnull", NS_KEYWORD, .op = &ignore_attr_op },
- { "__nonnull__", NS_KEYWORD, .op = &ignore_attr_op },
- { "format", NS_KEYWORD, .op = &ignore_attr_op },
- { "__format__", NS_KEYWORD, .op = &ignore_attr_op },
- { "format_arg", NS_KEYWORD, .op = &ignore_attr_op },
- { "__format_arg__", NS_KEYWORD, .op = &ignore_attr_op },
- { "section", NS_KEYWORD, .op = &ignore_attr_op },
- { "__section__",NS_KEYWORD, .op = &ignore_attr_op },
- { "unused", NS_KEYWORD, .op = &ignore_attr_op },
- { "__unused__", NS_KEYWORD, .op = &ignore_attr_op },
- { "const", NS_KEYWORD, .op = &ignore_attr_op },
- { "__const", NS_KEYWORD, .op = &ignore_attr_op },
- { "__const__", NS_KEYWORD, .op = &ignore_attr_op },
- { "no_instrument_function", NS_KEYWORD, .op = &ignore_attr_op },
- { "__no_instrument_function__", NS_KEYWORD, .op = &ignore_attr_op },
- { "sentinel", NS_KEYWORD, .op = &ignore_attr_op },
- { "__sentinel__", NS_KEYWORD, .op = &ignore_attr_op },
- { "regparm", NS_KEYWORD, .op = &ignore_attr_op },
- { "__regparm__", NS_KEYWORD, .op = &ignore_attr_op },
- { "weak", NS_KEYWORD, .op = &ignore_attr_op },
- { "__weak__", NS_KEYWORD, .op = &ignore_attr_op },
- { "alias", NS_KEYWORD, .op = &ignore_attr_op },
- { "__alias__", NS_KEYWORD, .op = &ignore_attr_op },
- { "pure", NS_KEYWORD, .op = &ignore_attr_op },
- { "__pure__", NS_KEYWORD, .op = &ignore_attr_op },
- { "always_inline", NS_KEYWORD, .op = &ignore_attr_op },
- { "__always_inline__", NS_KEYWORD, .op = &ignore_attr_op },
- { "syscall_linkage", NS_KEYWORD, .op = &ignore_attr_op },
- { "__syscall_linkage__", NS_KEYWORD, .op = &ignore_attr_op },
- { "visibility", NS_KEYWORD, .op = &ignore_attr_op },
- { "__visibility__", NS_KEYWORD, .op = &ignore_attr_op },
- { "deprecated", NS_KEYWORD, .op = &ignore_attr_op },
- { "__deprecated__", NS_KEYWORD, .op = &ignore_attr_op },
- { "noinline", NS_KEYWORD, .op = &ignore_attr_op },
- { "__noinline__", NS_KEYWORD, .op = &ignore_attr_op },
- { "used", NS_KEYWORD, .op = &ignore_attr_op },
- { "__used__", NS_KEYWORD, .op = &ignore_attr_op },
- { "warn_unused_result", NS_KEYWORD, .op = &ignore_attr_op },
- { "__warn_unused_result__", NS_KEYWORD, .op = &ignore_attr_op },
- { "model", NS_KEYWORD, .op = &ignore_attr_op },
- { "__model__", NS_KEYWORD, .op = &ignore_attr_op },
- { "cdecl", NS_KEYWORD, .op = &ignore_attr_op },
- { "__cdecl__", NS_KEYWORD, .op = &ignore_attr_op },
- { "stdcall", NS_KEYWORD, .op = &ignore_attr_op },
- { "__stdcall__", NS_KEYWORD, .op = &ignore_attr_op },
- { "fastcall", NS_KEYWORD, .op = &ignore_attr_op },
- { "__fastcall__", NS_KEYWORD, .op = &ignore_attr_op },
- { "dllimport", NS_KEYWORD, .op = &ignore_attr_op },
- { "__dllimport__", NS_KEYWORD, .op = &ignore_attr_op },
- { "dllexport", NS_KEYWORD, .op = &ignore_attr_op },
- { "__dllexport__", NS_KEYWORD, .op = &ignore_attr_op },
- { "constructor", NS_KEYWORD, .op = &ignore_attr_op },
- { "__constructor__", NS_KEYWORD, .op = &ignore_attr_op },
- { "destructor", NS_KEYWORD, .op = &ignore_attr_op },
- { "__destructor__", NS_KEYWORD, .op = &ignore_attr_op },
- { "cold", NS_KEYWORD, .op = &ignore_attr_op },
- { "__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 },
- { "bounded", NS_KEYWORD, .op = &ignore_attr_op },
- { "__bounded__", NS_KEYWORD, .op = &ignore_attr_op },
+const char *ignored_attributes[] = {
+ "alias",
+ "__alias__",
+ "always_inline",
+ "__always_inline__",
+ "bounded",
+ "__bounded__",
+ "cdecl",
+ "__cdecl__",
+ "cold",
+ "__cold__",
+ "const",
+ "__const",
+ "__const__",
+ "constructor",
+ "__constructor__",
+ "deprecated",
+ "__deprecated__",
+ "destructor",
+ "__destructor__",
+ "dllexport",
+ "__dllexport__",
+ "dllimport",
+ "__dllimport__",
+ "fastcall",
+ "__fastcall__",
+ "format",
+ "__format__",
+ "format_arg",
+ "__format_arg__",
+ "hot",
+ "__hot__",
+ "malloc",
+ "__malloc__",
+ "model",
+ "__model__",
+ "no_instrument_function",
+ "__no_instrument_function__",
+ "noinline",
+ "__noinline__",
+ "nonnull",
+ "__nonnull",
+ "__nonnull__",
+ "nothrow",
+ "__nothrow",
+ "__nothrow__",
+ "pure",
+ "__pure__",
+ "regparm",
+ "__regparm__",
+ "section",
+ "__section__",
+ "sentinel",
+ "__sentinel__",
+ "stdcall",
+ "__stdcall__",
+ "syscall_linkage",
+ "__syscall_linkage__",
+ "unused",
+ "__unused__",
+ "used",
+ "__used__",
+ "visibility",
+ "__visibility__",
+ "warn_unused_result",
+ "__warn_unused_result__",
+ "warning",
+ "__warning__",
+ "weak",
+ "__weak__",
};
+
void init_parser(int stream)
{
int i;
- for (i = 0; i < sizeof keyword_table/sizeof keyword_table[0]; i++) {
+ for (i = 0; i < ARRAY_SIZE(keyword_table); i++) {
struct init_keyword *ptr = keyword_table + i;
struct symbol *sym = create_symbol(stream, ptr->name, SYM_KEYWORD, ptr->ns);
sym->ident->keyword = 1;
@@ -556,8 +558,17 @@ void init_parser(int stream)
sym->ctype.base_type = ptr->type;
sym->op = ptr->op;
}
+
+ for (i = 0; i < ARRAY_SIZE(ignored_attributes); i++) {
+ const char * name = ignored_attributes[i];
+ struct symbol *sym = create_symbol(stream, name, SYM_KEYWORD,
+ NS_KEYWORD);
+ sym->ident->keyword = 1;
+ sym->op = &ignore_attr_op;
+ }
}
+
// Add a symbol to the list of function-local symbols
static void fn_local_symbol(struct symbol *sym)
{
--
1.6.0.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Ignore the ms_abi/sysv_abi attributes.
2009-09-29 23:30 ` Christopher Li
@ 2009-09-30 20:21 ` Michael Stefaniuc
2009-09-30 20:49 ` Christopher Li
0 siblings, 1 reply; 4+ messages in thread
From: Michael Stefaniuc @ 2009-09-30 20:21 UTC (permalink / raw)
To: Christopher Li; +Cc: linux-sparse
On 09/30/2009 01:30 AM, Christopher Li wrote:
> On Tue, Sep 29, 2009 at 2:01 PM, Michael Stefaniuc<mstefani@redhat.com> wrote:
>> This is needed for getting a meaningful sparse run on a Wine 64-bit
>> compile. Else the basic Win32 headers will produce tons of
>> error: attribute 'ms_abi': unknown attribute
>> which end in
>> error: too many errors.
>>
>> The sysv_abi attribute was just added for symmetry.
>
> Thanks for the patch. Ignoring the attribute has become so common now.
> I decide stop the complicate way to adding ignored attributes.
>
> I attach two patches to simplify things. I am I am going to push
> them out to chrisl tree.
>
> Can you change your patch base on my new patch?
Done!
> It should be really simple, just add one string for each attribute
> is good enough.
The nicest part about this is that the ignored attributes are now sorted
alphabetically and one doesn't have to figure out where exactly to add them.
thanks
bye
michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ignore the ms_abi/sysv_abi attributes.
2009-09-30 20:21 ` Michael Stefaniuc
@ 2009-09-30 20:49 ` Christopher Li
0 siblings, 0 replies; 4+ messages in thread
From: Christopher Li @ 2009-09-30 20:49 UTC (permalink / raw)
To: Michael Stefaniuc; +Cc: linux-sparse
On Wed, Sep 30, 2009 at 1:21 PM, Michael Stefaniuc <mstefani@redhat.com> wrote:
> The nicest part about this is that the ignored attributes are now sorted
> alphabetically and one doesn't have to figure out where exactly to add them.
Thanks, I like that too :-)
I actually write a five lines python script to short them and make sure
I did not drop some of the attributes.
Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-30 20:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29 21:01 Ignore the ms_abi/sysv_abi attributes Michael Stefaniuc
2009-09-29 23:30 ` Christopher Li
2009-09-30 20:21 ` Michael Stefaniuc
2009-09-30 20:49 ` Christopher Li
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).