Skip to contentSkip to conversation

Fix add missing include guard

PATCH Peter Zijlstra 1 participant 1 message Sep 8, 2014 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 12 lines · Anand Moon

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.

kernel/locking/lockdep_states.h +0 -0
@@ -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.

kernel/locking/lockdep_states.h line 15

Quoted 10 lines
kernel/locking/lockdep_states.h +6 -0
  */
+
+#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.