Fix "error macro requires 3 arguments" problem
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 19 Apr 2018 19:12:22 +0000 (15:12 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 30 Apr 2018 18:38:29 +0000 (14:38 -0400)
If you try to use the compile_time_assert, for whatever reason, some black
magic in the preprocessor thinks there's a call to error (standalone) in
there, which is the Plan 9 error throwing macro.  It breaks in a nasty way.

I don't know exactly what Linux is doing here, but renaming fixes it.  This
probably means we can't have a macro called error_foo() either.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/linux/compiler.h

index 6fa599f..63fe6ea 100644 (file)
@@ -512,8 +512,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 #ifndef __compiletime_warning
 # define __compiletime_warning(message)
 #endif
 #ifndef __compiletime_warning
 # define __compiletime_warning(message)
 #endif
-#ifndef __compiletime_error
-# define __compiletime_error(message)
+#ifndef __compiletime_error_foo
+# define __compiletime_error_foo(message)
 /*
  * Sparse complains of variable sized arrays due to the temporary variable in
  * __compiletime_assert. Unfortunately we can't just expand it out to make
 /*
  * Sparse complains of variable sized arrays due to the temporary variable in
  * __compiletime_assert. Unfortunately we can't just expand it out to make
@@ -533,7 +533,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 # define __compiletime_assert(condition, msg, prefix, suffix)          \
        do {                                                            \
                bool __cond = !(condition);                             \
 # define __compiletime_assert(condition, msg, prefix, suffix)          \
        do {                                                            \
                bool __cond = !(condition);                             \
-               extern void prefix ## suffix(void) __compiletime_error(msg); \
+               extern void prefix ## suffix(void) __compiletime_error_foo(msg); \
                if (__cond)                                             \
                        prefix ## suffix();                             \
                __compiletime_error_fallback(__cond);                   \
                if (__cond)                                             \
                        prefix ## suffix();                             \
                __compiletime_error_fallback(__cond);                   \