Skip to content

Commit

Permalink
Add WIP prototype for separate generation of declarations and body
Browse files Browse the repository at this point in the history
instead of just static inline functions.
Implemented for list only (and not for emplace generations)
  • Loading branch information
P-p-H-d committed Apr 22, 2023
1 parent 219c62f commit 8a2549e
Show file tree
Hide file tree
Showing 3 changed files with 285 additions and 325 deletions.
42 changes: 42 additions & 0 deletions m-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,48 @@ M_BEGIN_PROTECTED_CODE
#define M_UNLIKELY_NOMEM(cond) M_UNLIKELY(cond)


/***************************************************************/
/****************** Function Generation Macro ******************/
/***************************************************************/

/*
* Define the expansion logic to define a public / private / type function
* for inline expansion
*/
#define M_EXPAND_FUNC_INLINE(proto, ...) \
static inline proto __VA_ARGS__

#define M_EXPAND_FUNC_INLINE_PRIVATE(...) \
__VA_ARGS__

#define M_EXPAND_FUNC_INLINE_TYPE(...) \
__VA_ARGS__

/*
* Define the expansion logic to define a public / private / type function
* for inline expansion
*/
#define M_EXPAND_FUNC_DECL(proto, ...) \
extern proto;

#define M_EXPAND_FUNC_DECL_PRIVATE(...)

#define M_EXPAND_FUNC_DECL_TYPE(...) \
__VA_ARGS__

/*
* Define the expansion logic to define a public / private / type function
* for inline expansion
*/
#define M_EXPAND_FUNC_BODY(proto, ...) \
proto __VA_ARGS__

#define M_EXPAND_FUNC_BODY_PRIVATE(...) \
__VA_ARGS__

#define M_EXPAND_FUNC_BODY_TYPE(...)


/***************************************************************/
/****************** Preprocessing Times Macro ******************/
/***************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions m-i-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define MSTARLIB_I_LIST_H

#include "m-core.h"
#include "m-list.h" // For M_L1ST_ITBASE_DEF
#include "m-list.h" // For M_L1ST_DEF_ITBASE

/* Interface to add to a structure to enable intrusive doubly-linked support.
name: name of the intrusive list.
Expand Down Expand Up @@ -169,7 +169,7 @@ typedef struct m_il1st_head_s {
M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \
M_IL1ST_DEF_CORE(name, type, oplist, list_t, it_t) \
/* Used of internal macro from m-list */ \
M_L1ST_ITBASE_DEF(name, type, oplist, list_t, it_t)
M_L1ST_DEF_ITBASE(M_EXPAND_FUNC_INLINE, name, type, oplist, list_t, it_t)

/* Define the type of an intrusive list */
#define M_IL1ST_DEF_TYPE(name, type, oplist, list_t, it_t) \
Expand Down
Loading

0 comments on commit 8a2549e

Please sign in to comment.