macros.h

00001 
00002 /***************************************************************************
00003  *  macros.h - important macros
00004  *
00005  *  Created: Mon Dec 03 13:52:05 2007
00006  *  Copyright  2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __CORE_MACROS_H_
00025 #define __CORE_MACROS_H_
00026 
00027 // from http://blog.rlove.org/2005_10_01_archive.html
00028 // Note that __GNUC__ is also set appropriately by the Intel compiler
00029 #if __GNUC__ >= 3
00030 #  ifndef __inline
00031 #    define __inline    inline __attribute__ ((__always_inline__))
00032 #  endif
00033 #  ifndef __pure
00034 #    define __pure      __attribute__ ((__pure__))
00035 #  endif
00036 #  define __const_      __attribute__ ((__const__))
00037 #  define __noreturn    __attribute__ ((__noreturn__))
00038 #  define __malloc      __attribute__ ((__malloc__))
00039 #  define __must_check  __attribute__ ((__warn_unused_result__))
00040 #  define __deprecated  __attribute__ ((__deprecated__))
00041 #  ifndef __used
00042 #    define __used      __attribute__ ((__used__))
00043 #  endif
00044 #  ifndef __unused
00045 #    define __unused    __attribute__ ((__unused__))
00046 #  endif
00047 #  ifndef __packed
00048 #    define __packed    __attribute__ ((__packed__))
00049 #  endif
00050 #  ifndef __aligned
00051 #    define __aligned(x)   __attribute__ ((__aligned__ (x)))
00052 #  endif
00053 #  define likely(x)     __builtin_expect (!!(x), 1)
00054 #  define unlikely(x)   __builtin_expect (!!(x), 0)
00055 #else
00056 #  ifndef __inline
00057 #    define __inline    /* no inline */
00058 #  endif
00059 #  ifndef __pure
00060 #    define __pure              /* no pure */
00061 #  endif
00062 #  define __const_      /* no const */
00063 #  define __noreturn    /* no noreturn */
00064 #  define __malloc      /* no malloc */
00065 #  define __must_check  /* no warn_unused_result */
00066 #  define __deprecated  /* no deprecated */
00067 #  ifndef __used
00068 #    define __used              /* no used */
00069 #  endif
00070 #  ifndef __unused
00071 #    define __unused    /* no unused */
00072 #  endif
00073 #  ifndef __packed
00074 #    define __packed    /* no packed */
00075 #  endif
00076 #  ifndef __aligned
00077 #    define __aligned(x)   /* no align */
00078 #  endif
00079 #  define likely(x)     (x)
00080 #  define unlikely(x)   (x)
00081 #endif
00082 
00083 #endif

Generated on Tue Feb 22 13:31:25 2011 for Fawkes API by  doxygen 1.4.7