Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > contrib-release > by-pkgid > 24b00a2a0eb5a285df26cd26c1ede933 > files > 10

lib64rlog1-devel-1.3.7-2mdv2008.1.x86_64.rpm

/*****************************************************************************
 * Author:   Valient Gough <vgough@pobox.com>
 *
 *****************************************************************************
 * Copyright (c) 2002-2004, Valient Gough
 *
 * This library is free software; you can distribute it and/or modify it under
 * the terms of the GNU Lesser General Public License (LGPL), as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the LGPL in the file COPYING for more
 * details.
 *
 */

#ifndef _rlogconfig_incl_
#define _rlogconfig_incl_

/*! @file rlogconfig.h
  @brief Configuration macros for rlog.

*/

/*
    Defined by configure if our compiler allows us to specify printf attributes
    on a function pointer..  Newer versions of GCC allow this, but older ones
    do not..
*/
#define HAVE_PRINTF_FP 1

/*
    Defined by configure if our compiler understands VARIADAC macros.
*/
#define C99_VARIADAC_MACROS 1
#define PREC99_VARIADAC_MACROS 1

#define RLOG_TIME_TSC 1

/*
    We use __printf__ attribute to allow gcc to inspect printf style arguments
    and give warnings if the rDebug(), rWarning(), etc macros are misused.

    We use __builtin_expect on GCC 2.96 and above to allow optimization of
    publication activation check.  We tell the compiler that the branch is
    unlikely to occur, allowing GCC to push unecessary code out of the main
    path.
*/
#ifdef __GNUC__

# define PRINTF(FMT,X) __attribute__ (( __format__ ( __printf__, FMT, X)))
# define HAVE_PRINTF_ATTR 1

# if !defined( __builtin_expect )
#  define __builtin_expect(x,expected_value) (x)
# endif

# define   likely(x)  __builtin_expect((x),1)
# define unlikely(x)  __builtin_expect((x),0)

#else

// Not using the gcc compiler, make the macros do nothing..  They are
// documented as the last instance of the macros..

/*! @def PRINTF(FMT,X)
  On GCC, this uses the compiler's __printf__ attribute to tell the compiler
  to treat certain arguments as printf formating options, which allows it to
  print warnings at compile time if the arguments do not match the format
  string.
  @internal
*/
# define PRINTF(FMT,X)
# define HAVE_PRINTF_ATTR 0
/*!
*/
# define   likely(x)  (x)
/*! @def unlikely(x)
  Starting with GCC 2.96, we can tell the compiler that an if condition is
  likely or unlikely to occur, which allows the compiler to optimize for the
  normal case.
  @internal
*/
# define unlikely(x)  (x)

#endif

#if HAVE_PRINTF_FP
# define PRINTF_FP(FMT,X) PRINTF(FMT,X)
#else
# define PRINTF_FP(FMT,X)
#endif

/*! @def RLOG_COMPONENT
    @brief Specifies build-time component, eg -DRLOG_COMPONENT="component-name"

    Define RLOG_COMPONENT as the name of the component being built.
    For example, as a compile flag,  -DRLOG_COMPONENT="component-name"

    If RLOG_COMPONENT is not specified, then it will be defined as "[unknown]"
*/
#ifndef RLOG_COMPONENT
#  warning RLOG_COMPONENT not defined - setting to UNKNOWN
#define RLOG_COMPONENT "[unknown]"
#endif // RLOG_COMPONENT not defined

// Use somewhat unique names (doesn't matter if they aren't as they are used in
// a private context, so the compiler will make them unique if it must)
#  define LOGID CONCAT(_rL_, __LINE__)

#define RLOG_DECL

#endif // _rlogconfig_incl_