Commit f0c3ad0c authored by Linus Torvalds's avatar Linus Torvalds

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.
parent bae835a2
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
* destructors. * destructors.
*/ */
#if defined(__KERNEL__) && !defined(_KOBJECT_H_) #ifndef _KOBJECT_H_
#define _KOBJECT_H_ #define _KOBJECT_H_
#if __KERNEL__
#include <linux/types.h> #include <linux/types.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
...@@ -232,5 +234,5 @@ struct subsys_attribute { ...@@ -232,5 +234,5 @@ struct subsys_attribute {
extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
#endif /* __KERNEL__ */
#endif /* _KOBJECT_H_ */ #endif /* _KOBJECT_H_ */
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
* *
*/ */
#if defined(__KERNEL__) && !defined(_KREF_H_) #ifndef _KREF_H_
#define _KREF_H_ #define _KREF_H_
#if __KERNEL__
#include <linux/types.h> #include <linux/types.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -26,4 +28,5 @@ void kref_init(struct kref *kref); ...@@ -26,4 +28,5 @@ void kref_init(struct kref *kref);
void kref_get(struct kref *kref); void kref_get(struct kref *kref);
void kref_put(struct kref *kref, void (*release) (struct kref *kref)); void kref_put(struct kref *kref, void (*release) (struct kref *kref));
#endif /* __KERNEL__ */
#endif /* _KREF_H_ */ #endif /* _KREF_H_ */
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (markhe@nextd.demon.co.uk) * (markhe@nextd.demon.co.uk)
*/ */
#if !defined(_LINUX_SLAB_H) #ifndef _LINUX_SLAB_H
#define _LINUX_SLAB_H #define _LINUX_SLAB_H
#if defined(__KERNEL__) #if defined(__KERNEL__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment