Re: [RFC][PATCH] A generic boolean (version 3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Citerar Jan Engelhardt <[email protected]>:

> >+++ b/drivers/block/DAC960.h
> >@@ -71,7 +71,7 @@ #define DAC690_V2_PciDmaMask	0xfffffffff
> >   Define a Boolean data type.
> > */
> > 
> >-typedef enum { false, true } __attribute__ ((packed)) boolean;
> >+typedef bool boolean;
> > 
> Probably I missed some mail, but why can't we just have typedef _Bool bool?
> Like below?

Because it defines bool in include/asm/types.h, then "all" files will have the
bool-type. But because DAC960.h calles it boolean I just typedefed the new
bool-type to "boolean". Then if this gets into -mm or linus-tree, I/we can start
to clean up all the code using booleans. After all, there is also BOOL and
BOOLEAN but they are not effected by this change.

> 
> >+++ b/include/asm-i386/types.h
> >@@ -1,6 +1,13 @@
> > #ifndef _I386_TYPES_H
> > #define _I386_TYPES_H
> > 
> >+#if __GNUC__ >= 3
> >+typedef _Bool bool;
> >+#else
> >+#warning You compiler doesn't seem to support boolean types, will set
> 'bool' as
> >an 'unsigned int'
> >+typedef unsigned int bool;
> >+#endif
> >+
> > #ifndef __ASSEMBLY__
> > 
> > typedef unsigned short umode_t;
> >--- a/include/linux/stddef.h
> >+++ b/include/linux/stddef.h
> >@@ -10,6 +10,17 @@ #else
> > #define NULL ((void *)0)
> > #endif
> > 
> >+#undef false
> >+#undef true
> 
> Wasnot this supposed to go away?

#undef or enum?
There has not been any #undef's before, and enum I think is better. This since
Jeff showed it could be combined with the #define for the cpp's sake.

> 
> >+
> >+enum {
> >+	false	= 0,
> >+	true	= 1
> >+};
> >+
> >+#define false false
> >+#define true true 
> >+
> > #undef offsetof
> > #ifdef __compiler_offsetof
> > #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
> >
> 
> Jan Engelhardt

/Richard Knutsson
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux