Circular dependence in definition of debug macros: ensure, fatal, warning...
Assuming a class that only includes external header files but want to use the ensure
macro, the inclusion of debug.hpp
is not enough as is creates a circular dependence. For example:
../../../../src/arch/fpga/fpgapinnedallocator.cpp: In member function ‘uint64_t nanos::ext::FPGAPinnedAllocator::getBaseAddressPhy() const’:
../../../../src/support/debug.hpp:79:119: error: ‘getMyThreadSafe’ was not declared in this scope
#define ensure(cond,msg) if ( !(cond) ) throw nanos::FailedAssertion(__FILE__, __LINE__ , #cond, msg, getMyThreadSafe()->getId());
^
../../../../src/arch/fpga/fpgapinnedallocator.cpp:51:4: note: in expansion of macro ‘ensure’
The getMyThreadSafe
function is defined in basethread_decl.hpp
but this file also uses the ensure
macro, thereby it includes the debug.hpp
headers creating a circular dependence.