diff --git a/m-core.h b/m-core.h index 5e5e58df..3978c908 100644 --- a/m-core.h +++ b/m-core.h @@ -1263,6 +1263,15 @@ extern void m_no_default_function(void) __attribute__((error("The requested op #define M_NDEBUG_TEST 0 #define M_IF_DEBUG(a) M_IF(M_TEST_NDEBUG_P())(,a) + +/* If the Function Object is included, expands the code, + otherwise do nothing. + M_FUNCOBJ_IS_NOT_DEFINED is defined to 0. + NOTE: M_IF is the variable is not defined assummes yes. +*/ +#define M_IF_FUNCOBJ(a) M_IF(M_FUNCOBJ_IS_NOT_DEFINED)( ,a) + + /* Helper macro to redefine a function with a default value : If there is only one variable as the __VA_ARGS__, print __VA_ARGS__ then ', value', instead only __VA_ARGS__. diff --git a/m-funcobj.h b/m-funcobj.h index 55d48335..c070e8ac 100644 --- a/m-funcobj.h +++ b/m-funcobj.h @@ -23,7 +23,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MSTARLIB_FUNCOBJ_H -#define MSTARLIB_FUNCOBJ_H 1 +#define MSTARLIB_FUNCOBJ_H #include "m-core.h" @@ -70,6 +70,9 @@ /********************************** INTERNAL ************************************/ /********************************************************************************/ +/* To be used by M_IF_FUNCOBJ macro */ +#define M_FUNCOBJ_IS_NOT_DEFINED 0 + /* Design Constraints: * callback SHALL be the first member of the structures in all the definitions. *