Message ID | 200908061102.14935.kdudka@redhat.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
On Thu, Aug 6, 2009 at 11:02, Kamil Dudka<kdudka@redhat.com> wrote: > It's unfortunate to use 'true' and 'false' as identifiers in a system > header. It clashes with corresponding macros from <stdbool.h> when > included before <sparse/linearize.h>. > > Signed-off-by: Kamil Dudka <kdudka@redhat.com> > --- > linearize.h | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/linearize.h b/linearize.h > index 2205082..50b3601 100644 > --- a/linearize.h > +++ b/linearize.h > @@ -328,7 +328,7 @@ struct entrypoint { > struct instruction *entry; > }; > > -extern void insert_select(struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t true, pseudo_t false); > +extern void insert_select(struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t if_true, pseudo_t if_false); I guess it is wise to change this in linearize.c as well. Mind sending a patch? > extern void insert_branch(struct basic_block *bb, struct instruction *br, struct basic_block *target); > > pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, int size); Cheers, -Hannes -- 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
On Thu August 6 2009 11:23:26 Hannes Eder wrote: > On Thu, Aug 6, 2009 at 11:02, Kamil Dudka<kdudka@redhat.com> wrote: > > It's unfortunate to use 'true' and 'false' as identifiers in a system > > header. It clashes with corresponding macros from <stdbool.h> when > > included before <sparse/linearize.h>. > > > > Signed-off-by: Kamil Dudka <kdudka@redhat.com> > > --- > > linearize.h | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/linearize.h b/linearize.h > > index 2205082..50b3601 100644 > > --- a/linearize.h > > +++ b/linearize.h > > @@ -328,7 +328,7 @@ struct entrypoint { > > struct instruction *entry; > > }; > > > > -extern void insert_select(struct basic_block *bb, struct instruction > > *br, struct instruction *phi, pseudo_t true, pseudo_t false); +extern > > void insert_select(struct basic_block *bb, struct instruction *br, struct > > instruction *phi, pseudo_t if_true, pseudo_t if_false); > > I guess it is wise to change this in linearize.c as well. Mind sending a > patch? The question is if we need/want to :-) It's change of the working code for no real benefit. I am talking only about system-wide headers which can be included anywhere. Kamil -- 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
On Thu, Aug 6, 2009 at 11:30, Kamil Dudka<kdudka@redhat.com> wrote: > On Thu August 6 2009 11:23:26 Hannes Eder wrote: >> On Thu, Aug 6, 2009 at 11:02, Kamil Dudka<kdudka@redhat.com> wrote: >> > It's unfortunate to use 'true' and 'false' as identifiers in a system >> > header. It clashes with corresponding macros from <stdbool.h> when >> > included before <sparse/linearize.h>. >> > >> > Signed-off-by: Kamil Dudka <kdudka@redhat.com> >> > --- >> > Â linearize.h | Â Â 2 +- >> > Â 1 files changed, 1 insertions(+), 1 deletions(-) >> > >> > diff --git a/linearize.h b/linearize.h >> > index 2205082..50b3601 100644 >> > --- a/linearize.h >> > +++ b/linearize.h >> > @@ -328,7 +328,7 @@ struct entrypoint { >> > Â Â Â Â struct instruction *entry; >> > Â }; >> > >> > -extern void insert_select(struct basic_block *bb, struct instruction >> > *br, struct instruction *phi, pseudo_t true, pseudo_t false); +extern >> > void insert_select(struct basic_block *bb, struct instruction *br, struct >> > instruction *phi, pseudo_t if_true, pseudo_t if_false); >> >> I guess it is wise to change this in linearize.c as well. Â Mind sending a >> patch? > > The question is if we need/want to :-) It's change of the working code for no > real benefit. I am talking only about system-wide headers which can be > included anywhere. Well I see at least one benefit, a small one though. Syntax highlighting is somewhat confused with "true" and "false", at least emacs is. They appear like the constants, where in fact they are variables. The likelyhood to break the code by renaming this two variables is kinda low, no? And IHMO it was not so wise in the first place to pick these names. ;) My 2 cents -Hannes -- 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
On Thu August 6 2009 11:39:11 Hannes Eder wrote: > >> I guess it is wise to change this in linearize.c as well. Mind sending > >> a patch? > > > > The question is if we need/want to :-) It's change of the working code > > for no real benefit. I am talking only about system-wide headers which > > can be included anywhere. > > Well I see at least one benefit, a small one though. Syntax > highlighting is somewhat confused with "true" and "false", at least > emacs is. They appear like the constants, where in fact they are > variables. I can confirm it's the same case with the vim's syntax highlighter. > The likelyhood to break the code by renaming this two variables is > kinda low, no? And IHMO it was not so wise in the first place to pick > these names. ;) I would contend that only two variables are affected. They are if we consider only headers. However the situation is much worse when we concern about .c files. The patch would be non-trivial. Please try the following command: $ grep --color '[^_]false[^_]' *.c Kamil -- 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
On Thu, Aug 6, 2009 at 11:51, Kamil Dudka<kdudka@redhat.com> wrote: > On Thu August 6 2009 11:39:11 Hannes Eder wrote: >> >> I guess it is wise to change this in linearize.c as well. Â Mind sending >> >> a patch? >> > >> > The question is if we need/want to :-) It's change of the working code >> > for no real benefit. I am talking only about system-wide headers which >> > can be included anywhere. >> >> Well I see at least one benefit, a small one though. Â Syntax >> highlighting is somewhat confused with "true" and "false", at least >> emacs is. Â They appear like the constants, where in fact they are >> variables. > > I can confirm it's the same case with the vim's syntax highlighter. > >> The likelyhood to break the code by renaming this two variables is >> kinda low, no? Â And IHMO it was not so wise in the first place to pick >> these names. ;) > > I would contend that only two variables are affected. They are if we consider > only headers. However the situation is much worse when we concern about .c > files. The patch would be non-trivial. Please try the following command: > > $ grep --color '[^_]false[^_]' *.c $ grep --color '\bfalse\b\|\btrue\b' *.c | wc -l 91 some of them are just in comments, does not look to scary to me. If others agree that its a good idea to rename them, I can do it if you don't want to. -Hannes -- 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
On Thu, Aug 6, 2009 at 4:09 AM, Hannes Eder<hannes@hanneseder.net> wrote: >> $ grep --color '[^_]false[^_]' *.c > > $ grep --color '\bfalse\b\|\btrue\b' *.c | wc -l > 91 > > some of them are just in comments, does not look to scary to me. Â If > others agree that its a good idea to rename them, I can do it if you > don't want to. I would just apply the change to the header file and related variables. The linearize.h is consider an API header file for other sparse application to use. So we'd better not assume too much on the sparse caller side. I agree with Kamil that rename variable in linearize.c offer no real benefits. I consider it more of a personal preference thing. And it is internal to linearize.c. At this point renaming variable will mess up with annotations. It is not good enough reason to do it just to make the editor happy. Chris -- 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
From 4ad2c5943c1d0b16a19feefe721ebc53a4875a35 Mon Sep 17 00:00:00 2001 From: Kamil Dudka <kdudka@redhat.com> Date: Thu, 6 Aug 2009 10:54:56 +0200 Subject: [PATCH] linearize.h: sanitize header It's unfortunate to use 'true' and 'false' as identifiers in a system header. It clashes with corresponding macros from <stdbool.h> when included before <sparse/linearize.h>. Signed-off-by: Kamil Dudka <kdudka@redhat.com> --- linearize.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/linearize.h b/linearize.h index 2205082..50b3601 100644 --- a/linearize.h +++ b/linearize.h @@ -328,7 +328,7 @@ struct entrypoint { struct instruction *entry; }; -extern void insert_select(struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t true, pseudo_t false); +extern void insert_select(struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t if_true, pseudo_t if_false); extern void insert_branch(struct basic_block *bb, struct instruction *br, struct basic_block *target); pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, int size); -- 1.6.2.5