* Re: [PATCH] Fix add missing include guard
[not found] <1410106356-3543-1-git-send-email-moon.linux@yahoo.com>
@ 2014-09-08 6:15 ` Peter Zijlstra
0 siblings, 0 replies; only message in thread
From: Peter Zijlstra @ 2014-09-08 6:15 UTC (permalink / raw)
To: Anand Moon; +Cc: Ingo Molnar, linux-kernel
On Sun, Sep 07, 2014 at 09:42:36PM +0530, Anand Moon wrote:
> If a header file happens to be included twice, the compiler will process
> its contents twice. This is very likely to cause an error, e.g. when the
> compiler sees the same structure definition twice. Even if it does not,
> it will certainly waste time.
> --- a/kernel/locking/lockdep_states.h
> +++ b/kernel/locking/lockdep_states.h
> @@ -4,6 +4,12 @@
> * please update XXX_LOCK_USAGE_STATES in include/linux/lockdep.h whenever
> * you add one, or come up with a nice dynamic solution.
> */
> +
> +#ifndef __LOCKDEPSTATE_H__
> +#define __LOCKDEPSTATE_H__
> +
> LOCKDEP_STATE(HARDIRQ)
> LOCKDEP_STATE(SOFTIRQ)
> LOCKDEP_STATE(RECLAIM_FS)
> +
> +#endif /* __LOCKDEPSTATE_H__ */
That file is actually designed to be included multiple times; you
clearly didn't understand what you were doing.
^ permalink raw reply [flat|nested] only message in thread