LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Introduce simple TRUE and FALSE boolean macros.
@ 2007-01-21 10:03 Robert P. J. Day
  2007-01-21 17:51 ` Nicholas Miell
  0 siblings, 1 reply; 10+ messages in thread
From: Robert P. J. Day @ 2007-01-21 10:03 UTC (permalink / raw)
  To: Linux kernel mailing list; +Cc: Andrew Morton, linville


  Introduce the TRUE and FALSE boolean macros so that everyone can
stop re-inventing them, and remove the one occurrence in the source
tree that clashes with that change.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>

---

  once this patch is applied, others can remove all of the superfluous
macro definitions from the source tree at their convenience.

  this was compile tested on x86 with "make allyesconfig".


 drivers/net/wireless/strip.c |    2 --
 include/linux/types.h        |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ce3a8ba..5e64ec1 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -177,8 +177,6 @@ typedef struct {
 	MetricomNode node[NODE_TABLE_SIZE];
 } MetricomNodeTable;

-enum { FALSE = 0, TRUE = 1 };
-
 /*
  * Holds the radio's firmware version.
  */
diff --git a/include/linux/types.h b/include/linux/types.h
index 0351bf2..d988636 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -34,6 +34,8 @@ typedef __kernel_mqd_t		mqd_t;

 #ifdef __KERNEL__
 typedef _Bool			bool;
+#define TRUE			1
+#define FALSE			0

 typedef __kernel_uid32_t	uid_t;
 typedef __kernel_gid32_t	gid_t;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-21 10:03 [PATCH] Introduce simple TRUE and FALSE boolean macros Robert P. J. Day
@ 2007-01-21 17:51 ` Nicholas Miell
  2007-01-21 18:46   ` Richard Knutsson
  2007-01-21 19:40   ` Robert P. J. Day
  0 siblings, 2 replies; 10+ messages in thread
From: Nicholas Miell @ 2007-01-21 17:51 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list, Andrew Morton, linville

On Sun, 2007-01-21 at 05:03 -0500, Robert P. J. Day wrote:
>   Introduce the TRUE and FALSE boolean macros so that everyone can
> stop re-inventing them, and remove the one occurrence in the source
> tree that clashes with that change.
> 

If you're going to introduce true and false macros, you should probably
use the official all-lowercase C99 version.

-- 
Nicholas Miell <nmiell@comcast.net>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-21 17:51 ` Nicholas Miell
@ 2007-01-21 18:46   ` Richard Knutsson
  2007-01-21 19:40   ` Robert P. J. Day
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Knutsson @ 2007-01-21 18:46 UTC (permalink / raw)
  To: Nicholas Miell
  Cc: Robert P. J. Day, Linux kernel mailing list, Andrew Morton, linville

Nicholas Miell wrote:
> On Sun, 2007-01-21 at 05:03 -0500, Robert P. J. Day wrote:
>   
>>   Introduce the TRUE and FALSE boolean macros so that everyone can
>> stop re-inventing them, and remove the one occurrence in the source
>> tree that clashes with that change.
>>
>>     
>
> If you're going to introduce true and false macros, you should probably
> use the official all-lowercase C99 version.
>   
It is already in there (see include/linux/stddef.h). These are just to 
get rid of the defines of FALSE/TRUE all over the tree.
Not sure why, thou...


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-21 17:51 ` Nicholas Miell
  2007-01-21 18:46   ` Richard Knutsson
@ 2007-01-21 19:40   ` Robert P. J. Day
  2007-01-22 10:46     ` Nick Piggin
  1 sibling, 1 reply; 10+ messages in thread
From: Robert P. J. Day @ 2007-01-21 19:40 UTC (permalink / raw)
  To: Nicholas Miell; +Cc: Linux kernel mailing list, Andrew Morton, linville

On Sun, 21 Jan 2007, Nicholas Miell wrote:

> On Sun, 2007-01-21 at 05:03 -0500, Robert P. J. Day wrote:
> >   Introduce the TRUE and FALSE boolean macros so that everyone can
> > stop re-inventing them, and remove the one occurrence in the
> > source tree that clashes with that change.

> If you're going to introduce true and false macros, you should
> probably use the official all-lowercase C99 version.

i'm going to try this one more time, and see if i can get my point
across.  *yes*, the *eventual* goal should be to use the official
all-lowercase C99 versions of "true" and "false", and the patch i
proposed is, in fact, the first step in getting there.

by adding (temporarily) the definitions of TRUE and FALSE to types.h,
you should then (theoretically) be able to delete over 100 instances
of those same macros being *defined* throughout the source tree.
you're not going to be deleting the hundreds and hundreds of *uses* of
TRUE and FALSE (not yet, anyway) but, at the very least, by adding two
lines to types.h, you can delete all those redundant *definitions* and
make sure that nothing breaks.  (it shouldn't, of course, but it's
always nice to be sure.)

*now*, once that's done, you can start going through the tree and
doing the conversion from upper case to lower case, little by little,
subsystem by subsystem.

the predictable response will be, "you really should do that all at
once."  that's not going to happen, and you know it, and i know it.
that kind of change would be too big, and too disruptive.  so why not
just add two macro defines, then delete over 100 lines of what are now
redundant definitions, make sure nothing breaks, then move on to phase
two.

do we understand one another now?

rday

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-21 19:40   ` Robert P. J. Day
@ 2007-01-22 10:46     ` Nick Piggin
  2007-01-22 11:02       ` Robert P. J. Day
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Piggin @ 2007-01-22 10:46 UTC (permalink / raw)
  To: Robert P. J. Day
  Cc: Nicholas Miell, Linux kernel mailing list, Andrew Morton, linville

Robert P. J. Day wrote:

> by adding (temporarily) the definitions of TRUE and FALSE to types.h,
> you should then (theoretically) be able to delete over 100 instances
> of those same macros being *defined* throughout the source tree.
> you're not going to be deleting the hundreds and hundreds of *uses* of
> TRUE and FALSE (not yet, anyway) but, at the very least, by adding two
> lines to types.h, you can delete all those redundant *definitions* and
> make sure that nothing breaks.  (it shouldn't, of course, but it's
> always nice to be sure.)

Doesn't seem very worthwhile, and it legitimises this definition we're
trying to get rid of.

> *now*, once that's done, you can start going through the tree and
> doing the conversion from upper case to lower case, little by little,
> subsystem by subsystem.

I don't see why your patch is needed before the individual conversions?

> the predictable response will be, "you really should do that all at
> once."

You don't need to do it all at once.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-22 10:46     ` Nick Piggin
@ 2007-01-22 11:02       ` Robert P. J. Day
  2007-01-22 12:00         ` Nick Piggin
  2007-01-22 15:18         ` Mike Galbraith
  0 siblings, 2 replies; 10+ messages in thread
From: Robert P. J. Day @ 2007-01-22 11:02 UTC (permalink / raw)
  To: Nick Piggin
  Cc: Nicholas Miell, Linux kernel mailing list, Andrew Morton, linville

On Mon, 22 Jan 2007, Nick Piggin wrote:

> Robert P. J. Day wrote:
>
> > by adding (temporarily) the definitions of TRUE and FALSE to
> > types.h, you should then (theoretically) be able to delete over
> > 100 instances of those same macros being *defined* throughout the
> > source tree. you're not going to be deleting the hundreds and
> > hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
> > very least, by adding two lines to types.h, you can delete all
> > those redundant *definitions* and make sure that nothing breaks.
> > (it shouldn't, of course, but it's always nice to be sure.)
>
> Doesn't seem very worthwhile, and it legitimises this definition
> we're trying to get rid of.

hmmmmmmmm ... apparently, you totally missed my use of the important
word "temporarily":

  $ grep -r "temporary hack" . | wc -l
  16

rday

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-22 11:02       ` Robert P. J. Day
@ 2007-01-22 12:00         ` Nick Piggin
  2007-01-22 15:18         ` Mike Galbraith
  1 sibling, 0 replies; 10+ messages in thread
From: Nick Piggin @ 2007-01-22 12:00 UTC (permalink / raw)
  To: Robert P. J. Day
  Cc: Nicholas Miell, Linux kernel mailing list, Andrew Morton, linville

Robert P. J. Day wrote:
> On Mon, 22 Jan 2007, Nick Piggin wrote:
> 
> 
>>Robert P. J. Day wrote:
>>
>>
>>>by adding (temporarily) the definitions of TRUE and FALSE to
>>>types.h, you should then (theoretically) be able to delete over
>>>100 instances of those same macros being *defined* throughout the
>>>source tree. you're not going to be deleting the hundreds and
>>>hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
>>>very least, by adding two lines to types.h, you can delete all
>>>those redundant *definitions* and make sure that nothing breaks.
>>>(it shouldn't, of course, but it's always nice to be sure.)
>>
>>Doesn't seem very worthwhile, and it legitimises this definition
>>we're trying to get rid of.
> 
> 
> hmmmmmmmm ... apparently, you totally missed my use of the important
> word "temporarily":

No, I didn't.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-22 11:02       ` Robert P. J. Day
  2007-01-22 12:00         ` Nick Piggin
@ 2007-01-22 15:18         ` Mike Galbraith
  2007-01-22 15:41           ` Robert P. J. Day
  1 sibling, 1 reply; 10+ messages in thread
From: Mike Galbraith @ 2007-01-22 15:18 UTC (permalink / raw)
  To: Robert P. J. Day
  Cc: Nick Piggin, Nicholas Miell, Linux kernel mailing list,
	Andrew Morton, linville

On Mon, 2007-01-22 at 06:02 -0500, Robert P. J. Day wrote:
> On Mon, 22 Jan 2007, Nick Piggin wrote:
> 
> > Robert P. J. Day wrote:
> >
> > > by adding (temporarily) the definitions of TRUE and FALSE to
> > > types.h, you should then (theoretically) be able to delete over
> > > 100 instances of those same macros being *defined* throughout the
> > > source tree. you're not going to be deleting the hundreds and
> > > hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
> > > very least, by adding two lines to types.h, you can delete all
> > > those redundant *definitions* and make sure that nothing breaks.
> > > (it shouldn't, of course, but it's always nice to be sure.)
> >
> > Doesn't seem very worthwhile, and it legitimises this definition
> > we're trying to get rid of.
> 
> hmmmmmmmm ... apparently, you totally missed my use of the important
> word "temporarily":
> 
>   $ grep -r "temporary hack" . | wc -l
>   16

That's a pretty good argument _against_ adding another one :)  I wonder
how old those "temporary hacks" are (the ones you missed as well).

To make TRUE/FALSE go away, you or someone will have to visit them all,
which will take time.  Why add an intermediate step where you or others
can end up getting interrupted (indefinitely), leaving the "temporary"
definition lying around for folks to use?

	-Mike


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-22 15:18         ` Mike Galbraith
@ 2007-01-22 15:41           ` Robert P. J. Day
  2007-01-22 16:52             ` Jan Engelhardt
  0 siblings, 1 reply; 10+ messages in thread
From: Robert P. J. Day @ 2007-01-22 15:41 UTC (permalink / raw)
  To: Mike Galbraith
  Cc: Nick Piggin, Nicholas Miell, Linux kernel mailing list,
	Andrew Morton, linville

On Mon, 22 Jan 2007, Mike Galbraith wrote:

> On Mon, 2007-01-22 at 06:02 -0500, Robert P. J. Day wrote:
> > On Mon, 22 Jan 2007, Nick Piggin wrote:
> >
> > > Robert P. J. Day wrote:
> > >
> > > > by adding (temporarily) the definitions of TRUE and FALSE to
> > > > types.h, you should then (theoretically) be able to delete over
> > > > 100 instances of those same macros being *defined* throughout the
> > > > source tree. you're not going to be deleting the hundreds and
> > > > hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
> > > > very least, by adding two lines to types.h, you can delete all
> > > > those redundant *definitions* and make sure that nothing breaks.
> > > > (it shouldn't, of course, but it's always nice to be sure.)
> > >
> > > Doesn't seem very worthwhile, and it legitimises this definition
> > > we're trying to get rid of.
> >
> > hmmmmmmmm ... apparently, you totally missed my use of the important
> > word "temporarily":
> >
> >   $ grep -r "temporary hack" . | wc -l
> >   16
>
> That's a pretty good argument _against_ adding another one :)  I
> wonder how old those "temporary hacks" are (the ones you missed as
> well).
>
> To make TRUE/FALSE go away, you or someone will have to visit them
> all, which will take time.  Why add an intermediate step where you
> or others can end up getting interrupted (indefinitely), leaving the
> "temporary" definition lying around for folks to use?

as opposed to the 100+ *other* definitions currently cluttering up the
tree, which this patch would allow to be deleted *immediately*.

forget it.  i can see this argument is going nowhere and that, six
months from now, some poor sucker is going to post, asking, "hey, you
know all these TRUE/FALSE things?  wouldn't it be great if we could,
you know, clean those up?  whaddya say?"

and groundhog day will begin all over again ...

rday

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Introduce simple TRUE and FALSE boolean macros.
  2007-01-22 15:41           ` Robert P. J. Day
@ 2007-01-22 16:52             ` Jan Engelhardt
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Engelhardt @ 2007-01-22 16:52 UTC (permalink / raw)
  To: Robert P. J. Day
  Cc: Mike Galbraith, Nick Piggin, Nicholas Miell,
	Linux kernel mailing list, Andrew Morton, linville


On Jan 22 2007 10:41, Robert P. J. Day wrote:
>
>as opposed to the 100+ *other* definitions currently cluttering up the
>tree, which this patch would allow to be deleted *immediately*.
>
>forget it.  i can see this argument is going nowhere and that, six
>months from now, some poor sucker is going to post, asking, "hey, you
>know all these TRUE/FALSE things?  wouldn't it be great if we could,
>you know, clean those up?  whaddya say?"
>
>and groundhog day will begin all over again ...

I don't get it why it's so hard to do (b) over (a)

  (a) remove all TRUE/FALSE and add TRUE/FALSE to linux/types.h
      as per http://lkml.org/lkml/2007/1/21/19

  (b) see below

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>

Index: linux-2.6.20-rc5/drivers/net/wireless/strip.c
===================================================================
--- linux-2.6.20-rc5.orig/drivers/net/wireless/strip.c
+++ linux-2.6.20-rc5/drivers/net/wireless/strip.c
@@ -177,8 +177,6 @@ typedef struct {
 	MetricomNode node[NODE_TABLE_SIZE];
 } MetricomNodeTable;
 
-enum { FALSE = 0, TRUE = 1 };
-
 /*
  * Holds the radio's firmware version.
  */
@@ -1209,7 +1207,7 @@ static void ResetRadio(struct strip *str
 	if (!strip_info->manual_dev_addr)
 		*(MetricomAddress *) strip_info->dev->dev_addr =
 		    zero_address;
-	strip_info->working = FALSE;
+	strip_info->working = false;
 	strip_info->firmware_level = NoStructure;
 	strip_info->next_command = CompatibilityCommand;
 	strip_info->watchdog_doprobe = jiffies + 10 * HZ;
@@ -1845,7 +1843,7 @@ static void RecvErr_Message(struct strip
 		}
 #endif
 		if (!strip_info->working) {
-			strip_info->working = TRUE;
+			strip_info->working = true;
 			printk(KERN_INFO "%s: Radio now in starmode\n",
 			       strip_info->dev->name);
 			/*
@@ -2455,7 +2453,7 @@ static int strip_open_low(struct net_dev
 	strip_info->tx_left = 0;
 
 	strip_info->discard = 0;
-	strip_info->working = FALSE;
+	strip_info->working = false;
 	strip_info->firmware_level = NoStructure;
 	strip_info->next_command = CompatibilityCommand;
 	strip_info->user_baud = get_baud(strip_info->tty);
#<EOF>


	-`J'
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-01-22 16:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-21 10:03 [PATCH] Introduce simple TRUE and FALSE boolean macros Robert P. J. Day
2007-01-21 17:51 ` Nicholas Miell
2007-01-21 18:46   ` Richard Knutsson
2007-01-21 19:40   ` Robert P. J. Day
2007-01-22 10:46     ` Nick Piggin
2007-01-22 11:02       ` Robert P. J. Day
2007-01-22 12:00         ` Nick Piggin
2007-01-22 15:18         ` Mike Galbraith
2007-01-22 15:41           ` Robert P. J. Day
2007-01-22 16:52             ` Jan Engelhardt

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).