00001 /***************************************************************************** 00002 * Author: Valient Gough <vgough@pobox.com> 00003 * 00004 ***************************************************************************** 00005 * Copyright (c) 2002-2004, Valient Gough 00006 * 00007 * This library is free software; you can distribute it and/or modify it under 00008 * the terms of the GNU Lesser General Public License (LGPL), as published by 00009 * the Free Software Foundation; either version 2.1 of the License, or (at your 00010 * option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the LGPL in the file COPYING for more 00015 * details. 00016 * 00017 */ 00018 00019 #ifndef _rlogconfig_incl_ 00020 #define _rlogconfig_incl_ 00021 00027 /* 00028 Defined by configure if our compiler allows us to specify printf attributes 00029 on a function pointer.. Newer versions of GCC allow this, but older ones 00030 do not.. 00031 */ 00032 #define HAVE_PRINTF_FP 1 00033 00034 /* 00035 Defined by configure if our compiler understands VARIADAC macros. 00036 */ 00037 #define C99_VARIADAC_MACROS 1 00038 #define PREC99_VARIADAC_MACROS 1 00039 00040 #define RLOG_TIME_TSC @HAVE_TSC@ 00041 00042 /* 00043 We use __printf__ attribute to allow gcc to inspect printf style arguments 00044 and give warnings if the rDebug(), rWarning(), etc macros are misused. 00045 00046 We use __builtin_expect on GCC 2.96 and above to allow optimization of 00047 publication activation check. We tell the compiler that the branch is 00048 unlikely to occur, allowing GCC to push unecessary code out of the main 00049 path. 00050 */ 00051 #ifdef __GNUC__ 00052 00053 # define PRINTF(FMT,X) __attribute__ (( __format__ ( __printf__, FMT, X))) 00054 # define HAVE_PRINTF_ATTR 1 00055 # define RLOG_SECTION __attribute__ (( section("RLOG_DATA") )) 00056 00057 #if __GNUC__ >= 3 00058 # define expect(foo, bar) __builtin_expect((foo),bar) 00059 #else 00060 # define expect(foo, bar) (foo) 00061 #endif 00062 00063 # define likely(x) expect((x),1) 00064 # define unlikely(x) expect((x),0) 00065 00066 #else 00067 00068 // Not using the gcc compiler, make the macros do nothing.. They are 00069 // documented as the last instance of the macros.. 00070 00078 # define PRINTF(FMT,X) 00079 # define HAVE_PRINTF_ATTR 0 00080 # define RLOG_SECTION 00081 00084 # define likely(x) (x) 00085 00091 # define unlikely(x) (x) 00092 00093 #endif 00094 00095 #if HAVE_PRINTF_FP 00096 # define PRINTF_FP(FMT,X) PRINTF(FMT,X) 00097 #else 00098 # define PRINTF_FP(FMT,X) 00099 #endif 00100 00109 #ifndef RLOG_COMPONENT 00110 # warning RLOG_COMPONENT not defined - setting to UNKNOWN 00111 #define RLOG_COMPONENT "[unknown]" 00112 #endif // RLOG_COMPONENT not defined 00113 00114 // Use somewhat unique names (doesn't matter if they aren't as they are used in 00115 // a private context, so the compiler will make them unique if it must) 00116 # define LOGID CONCAT(_rL_, __LINE__) 00117 00118 #define RLOG_DECL 00119 00120 #endif // _rlogconfig_incl_ 00121