]> git.hungrycats.org Git - linux/commitdiff
Allow the compiler to notice "constant" header file.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 31 Aug 2004 14:07:07 +0000 (07:07 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 31 Aug 2004 14:07:07 +0000 (07:07 -0700)
Both gcc and sparse will speed up tokenization by noticing
when a header file is protected by the standard preprocessor
#ifndef .. #endif exclusion.

However, that requires that the headers actually _use_ that
standard exclusion. Some did their own little broken dance.

include/linux/kobject.h
include/linux/kref.h
include/linux/slab.h

index 4ec94fa8163ffc19d0da4cb9dddeafbeb63d3fc4..f3f20feee67b091c4f8d18635c4dd0600edeb957 100644 (file)
  * destructors. 
  */
 
-#if defined(__KERNEL__) && !defined(_KOBJECT_H_)
+#ifndef _KOBJECT_H_
 #define _KOBJECT_H_
 
+#if __KERNEL__
+
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/sysfs.h>
@@ -232,5 +234,5 @@ struct subsys_attribute {
 extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
 extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
 
-
+#endif /* __KERNEL__ */
 #endif /* _KOBJECT_H_ */
index 119c74eca194abcb0daf2bb48eb0f9dd5c71b5f2..a8a8b05ca3d0a4f7baac8d7499c294d3e905acc5 100644 (file)
  *
  */
 
-#if defined(__KERNEL__) && !defined(_KREF_H_)
+#ifndef _KREF_H_
 #define _KREF_H_
 
+#if __KERNEL__
+
 #include <linux/types.h>
 #include <asm/atomic.h>
 
@@ -26,4 +28,5 @@ void kref_init(struct kref *kref);
 void kref_get(struct kref *kref);
 void kref_put(struct kref *kref, void (*release) (struct kref *kref));
 
+#endif /* __KERNEL__ */
 #endif /* _KREF_H_ */
index f5d2410d8851c264c6940ce0b63a7c35e9c08abc..5859a06f458c29195c6ea4f3226aac79ba33c252 100644 (file)
@@ -4,7 +4,7 @@
  * (markhe@nextd.demon.co.uk)
  */
 
-#if    !defined(_LINUX_SLAB_H)
+#ifndef _LINUX_SLAB_H
 #define        _LINUX_SLAB_H
 
 #if    defined(__KERNEL__)