]> err.no Git - linux-2.6/blobdiff - fs/xfs/support/debug.h
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[linux-2.6] / fs / xfs / support / debug.h
index 4f54dca662a89ca646f9ff27a51d129a1c42a4de..a27a7c8c05264c1e651e0c0651d9caa4eec64c7f 100644 (file)
@@ -38,13 +38,37 @@ extern void assfail(char *expr, char *f, int l);
 
 #ifndef DEBUG
 # define ASSERT(expr)  ((void)0)
-#else
-# define ASSERT(expr)  ASSERT_ALWAYS(expr)
-extern unsigned long random(void);
+
+#ifndef STATIC
+# define STATIC static noinline
 #endif
 
+#ifndef STATIC_INLINE
+# define STATIC_INLINE static inline
+#endif
+
+#else /* DEBUG */
+
+# define ASSERT(expr)  ASSERT_ALWAYS(expr)
+# include <linux/random.h>
+
 #ifndef STATIC
-# define STATIC static
+# define STATIC noinline
 #endif
 
+/*
+ * We stop inlining of inline functions in debug mode.
+ * Unfortunately, this means static inline in header files
+ * get multiple definitions, so they need to remain static.
+ * This then gives tonnes of warnings about unused but defined
+ * functions, so we need to add the unused attribute to prevent
+ * these spurious warnings.
+ */
+#ifndef STATIC_INLINE
+# define STATIC_INLINE static __attribute__ ((unused)) noinline
+#endif
+
+#endif /* DEBUG */
+
+
 #endif  /* __XFS_SUPPORT_DEBUG_H__ */