X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;ds=inline;f=src%2Fbase%2Fcl_macros.h;h=60a39e956bf19d0caf59fe77cd9a9efb4d28913f;hb=040ed6f6ed478f65442b2e0fee05c19b42c0d5e9;hp=bf28b2a0c5a4fe4707efa0eeabf3917f8789d1b1;hpb=850abfde7f0d985ba01526c346bcd0d733562943;p=cln.git diff --git a/src/base/cl_macros.h b/src/base/cl_macros.h index bf28b2a..60a39e9 100644 --- a/src/base/cl_macros.h +++ b/src/base/cl_macros.h @@ -3,6 +3,9 @@ #ifndef _CL_MACROS_H #define _CL_MACROS_H +#include "cln/types.h" +#include "cln/exception.h" + // Concatenation of macroexpanded tokens. // Example: // #undef x @@ -29,7 +32,7 @@ // Declare functions that don't return. // nonreturning_function(extern,exit,(void)); == extern void exit (void); #ifdef __GNUC__ - #if (__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 90)) + #if (__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9)) #define nonreturning_function(storclass,funname,arguments) \ storclass void funname arguments __attribute__((__noreturn__)) #else @@ -71,10 +74,7 @@ // Denotes a point where control flow can never arrive. // NOTREACHED - #define NOTREACHED cl_notreached_abort(__FILE__,__LINE__); -namespace cln { - nonreturning_function(extern,cl_notreached_abort, (const char* filename, int lineno)); -} // namespace cln + #define NOTREACHED throw notreached_exception(__FILE__,__LINE__); // Check an arithmetic expression. // ASSERT(expr) @@ -93,7 +93,7 @@ namespace cln { #if defined(__osf__) extern "C" char* alloca (int size); #else - extern "C" void* alloca (int size); + extern "C" void* alloca (size_t size); #endif #endif #elif defined(_AIX) @@ -101,17 +101,25 @@ namespace cln { #elif defined(WATCOM) #include // defines `alloca' as a macro #elif !defined(NO_ALLOCA) - extern "C" void* alloca (int size); + extern "C" void* alloca (size_t size); #endif // NULL pointer. #undef NULL #define NULL 0 -// Bit number n (0<=n<32) - #define bit(n) (1L<<(n)) +// Bit number n (0<=n<32 or 0<=n<64) + #ifdef HAVE_FAST_LONGLONG + #define bit(n) (1LL<<(n)) + #else + #define bit(n) (1L<<(n)) + #endif // Bit number n (0=long_bitsize. - #define bitc(n) (1UL << (((n) >= 0 && (n) < long_bitsize) ? (n) : 0)) +// Same as bit(n), but undefined if n<0 or n>={long_}long_bitsize. + #if defined(HAVE_FAST_LONGLONG) || defined(intQsize) + #define bitc(n) (1ULL << (((n) >= 0 && (n) < long_long_bitsize) ? (n) : 0)) + #else + #define bitc(n) (1UL << (((n) >= 0 && (n) < long_bitsize) ? (n) : 0)) + #endif // floor(a,b) for a>=0, b>0 returns floor(a/b). // b should be a constant expression. @@ -174,7 +194,7 @@ namespace cln { } // doconsttimes(count,statement); -// führt statement count mal aus (count mal der Code!), +// führt statement count mal aus (count mal der Code!), // wobei count eine constant-expression >=0, <=8 ist. #define doconsttimes(count_from_doconsttimes,statement_from_doconsttimes) \ { if (0 < (count_from_doconsttimes)) { statement_from_doconsttimes; } \ @@ -190,7 +210,7 @@ namespace cln { // DOCONSTTIMES(count,macroname); // ruft count mal den Macro macroname auf (count mal der Code!), // wobei count eine constant-expression >=0, <=8 ist. -// Dabei bekommt macroname der Reihe nach die Werte 0,...,count-1 übergeben. +// Dabei bekommt macroname der Reihe nach die Werte 0,...,count-1 übergeben. #define DOCONSTTIMES(count_from_DOCONSTTIMES,macroname_from_DOCONSTTIMES) \ { if (0 < (count_from_DOCONSTTIMES)) { macroname_from_DOCONSTTIMES((0 < (count_from_DOCONSTTIMES) ? 0 : 0)); } \ if (1 < (count_from_DOCONSTTIMES)) { macroname_from_DOCONSTTIMES((1 < (count_from_DOCONSTTIMES) ? 1 : 0)); } \ @@ -245,9 +265,6 @@ public: \ // it's a shame!) #define init1(type,lvalue) (void) new (&(lvalue)) type -// MAYBE_INLINE normally expands to nothing. -// Useful for including the implementation of some file inline into another. - #define MAYBE_INLINE - #define MAYBE_INLINE2 +#include "cl_maybe_inline.h" #endif /* _CL_MACROS_H */