From f0c3ad0c470451c21206aaf3fe028042494b3af7 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 31 Aug 2004 07:07:07 -0700 Subject: 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. --- include/linux/kobject.h | 6 ++++-- include/linux/kref.h | 5 ++++- include/linux/slab.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'include/linux') 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 #include #include @@ -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 #include @@ -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__) -- cgit v1.2.3