Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-19 08:08:31

0001 // Macros for correct module ordering.
0002 
0003 #ifndef _CL_MODULES_H
0004 #define _CL_MODULES_H
0005 
0006 // global constructor/destructor naming.
0007 #include "cln/config.h"
0008 
0009 // Concatenation of macroexpanded tokens.
0010 // Equivalent to CL_CONCAT in src/base/cl_macros.h which we do not want
0011 // to expose, however.
0012 #define CL_CONCATENATE_(xxx,yyy)  xxx##yyy
0013 #define CL_CONCATENATE(xxx,yyy)  CL_CONCATENATE_(xxx,yyy)
0014 
0015 // Sometimes a link time dependency is needed, but without requirements
0016 // on initialization order.
0017 //
0018 // CL_FORCE_LINK(dummy,external_variable)
0019 // forces a link time reference to the external_variable.
0020 #include <cstdlib>
0021 #if 0
0022 // This definition does not work.  It gets optimized away by g++ 3.1.
0023 #define CL_FORCE_LINK(dummy,external_variable) \
0024   static const void* const dummy[] = { &dummy, &external_variable };
0025 #else
0026 #define CL_FORCE_LINK(dummy,external_variable) \
0027   static const                              \
0028   struct dummy {                            \
0029     inline dummy () {                           \
0030       if ((void*) &external_variable == (void*) this)           \
0031         abort();                            \
0032     }                                   \
0033   }                                 \
0034   CL_CONCATENATE(dummy,_instance);
0035 #endif
0036 
0037 #endif /* _CL_MODULES_H */