I was going through the lustre source code and was stuck at the macro definition:
#define ldlm_namespace_proc_unregister(ns) ({;})
#define ldlm_namespace_proc_register(ns) ({0;})
defined in the file lustre/ldlm/ldlm_resource.c
.
What does this macro definition signify?
Macros are a plain text replacement. This macro means that a piece of code ldlm_namespace_proc_register(x)
will be transformed to ({0;})
. Nothing more and nothing less.
If you are also wondering about the meaning of the code ({;})
and ({0;})
then these are GCC expression statements.
According to that documentation, ({0;})
should be exactly the same as 0
, and ({;})
is an expression of type void
.
Speculation follows: the purpose of these macros might be to support the user of the library writing code like this:
int result = ldlm_namespace_proc_register(x);
// ...
ldlm_namespace_proc_unregister(x);
but also that depending on compiler switches or other configuration, this code may either actually call a function, or in the case where your lines are enabled, actually do nothing.