Commit b75be420 authored by Linus Walleij's avatar Linus Walleij Committed by Rusty Russell

param: add null statement to compiled-in module params

Add an unused struct declaration statement requiring a
terminating semicolon to the compile-in case to provoke an
error if __MODULE_INFO() is used without the terminating
semicolon. Previously MODULE_ALIAS("foo") (no semicolon)
compiled fine if MODULE was not selected.

Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 3b90a5b2
...@@ -16,15 +16,17 @@ ...@@ -16,15 +16,17 @@
/* Chosen so that structs with an unsigned long line up. */ /* Chosen so that structs with an unsigned long line up. */
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
#ifdef MODULE
#define ___module_cat(a,b) __mod_ ## a ## b #define ___module_cat(a,b) __mod_ ## a ## b
#define __module_cat(a,b) ___module_cat(a,b) #define __module_cat(a,b) ___module_cat(a,b)
#ifdef MODULE
#define __MODULE_INFO(tag, name, info) \ #define __MODULE_INFO(tag, name, info) \
static const char __module_cat(name,__LINE__)[] \ static const char __module_cat(name,__LINE__)[] \
__used __attribute__((section(".modinfo"), unused, aligned(1))) \ __used __attribute__((section(".modinfo"), unused, aligned(1))) \
= __stringify(tag) "=" info = __stringify(tag) "=" info
#else /* !MODULE */ #else /* !MODULE */
#define __MODULE_INFO(tag, name, info) /* This struct is here for syntactic coherency, it is not used */
#define __MODULE_INFO(tag, name, info) \
struct __module_cat(name,__LINE__) {}
#endif #endif
#define __MODULE_PARM_TYPE(name, _type) \ #define __MODULE_PARM_TYPE(name, _type) \
__MODULE_INFO(parmtype, name##type, #name ":" _type) __MODULE_INFO(parmtype, name##type, #name ":" _type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment