summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-31 07:07:07 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-31 07:07:07 -0700
commitf0c3ad0c470451c21206aaf3fe028042494b3af7 (patch)
treee9cf47b2a00894ed024e0636afcca0083f622396 /include/linux
parentbae835a2d8e115a9b62eac5f001f32fb5a5626d3 (diff)
Allow the compiler to notice "constant" header file.
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.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kobject.h6
-rw-r--r--include/linux/kref.h5
-rw-r--r--include/linux/slab.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 4ec94fa8163f..f3f20feee67b 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -12,9 +12,11 @@
* 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_ */
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 119c74eca194..a8a8b05ca3d0 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -12,9 +12,11 @@
*
*/
-#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_ */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f5d2410d8851..5859a06f458c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -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__)