#ifndef __CDS_DEFS_H
#define __CDS_DEFS_H
+#include <stddef.h>
#include <assert.h>
#include <cstdint>
#include <exception>
}
};
-//@cond
-# define CDS_PURE_VIRTUAL_FUNCTION_CALLED { assert(false); throw Exception("Pure virtual function called"); }
-# define CDS_PURE_VIRTUAL_FUNCTION_CALLED_(method_name) { assert(false); throw Exception("Pure virtual function called " method_name ); }
-//@endcond
-
/// any_type is used as a placeholder for auto-calculated type (usually in \p rebind templates)
struct any_type {};
- /** \def CDS_DECLARE_EXCEPTION( _class, _msg )
- Simplifying declaration of specific exception (usual within classes)
- - @p _class - the class name of exception
- - @p _msg - exception message (const char *)
- */
-#define CDS_DECLARE_EXCEPTION( _class, _msg ) \
- struct _class: public std::exception { \
- public: \
- _class(): std::exception() {} \
- virtual const char * what( ) const throw() { return _msg; } \
- }
-
} // namespace cds
-
-//@cond
-#ifdef _DEBUG
-# define cds_assert(X) assert(X)
-#else
-# include <stdio.h> // snprintf
- static inline void cds_assert_( bool bCond, char const * pszMsg, char const * pszFile, int nLine )
- {
- if ( !bCond ) {
- char buf[4096];
-# if CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CS_OSI_WINDOWS)
- _snprintf_s( buf, sizeof(buf)/sizeof(buf[0]), _TRUNCATE, pszMsg, pszFile, nLine );
-# else
- snprintf( buf, sizeof(buf)/sizeof(buf[0]), pszMsg, pszFile, nLine );
-# endif
- throw cds::Exception( buf );
- }
- }
-# define cds_assert(X) cds_assert_( X, "%s (%d): Assert failed: " #X, __FILE__, __LINE__ );
-#endif
-//@endcond
-
#endif // #ifndef __CDS_DEFS_H