00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 00002 /* dbus-valgrind-internal.h - valgrind glue 00003 * 00004 * Copyright © 2011 Nokia Corporation 00005 * 00006 * Licensed under the Academic Free License version 2.1 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef DBUS_VALGRIND_INTERNAL_H 00026 #define DBUS_VALGRIND_INTERNAL_H 00027 00028 #include "config.h" 00029 #include "dbus-internals.h" 00030 00031 #ifdef WITH_VALGRIND 00032 # include <memcheck.h> 00033 # include <valgrind.h> 00034 #else 00035 # define VALGRIND_CREATE_MEMPOOL(_1, _2, _3) /* nothing */ 00036 # define VALGRIND_DESTROY_MEMPOOL(_1) /* nothing */ 00037 # define VALGRIND_MEMPOOL_ALLOC(_1, _2, _3) /* nothing */ 00038 # define VALGRIND_MEMPOOL_FREE(_1, _2) /* nothing */ 00039 00040 /* Recent gcc will warn if you have a statement that's just a macro 00041 * expanding to (0), but not if you have an inline stub function that 00042 * always returns 0, so let's do the latter. */ 00043 static inline int 00044 VALGRIND_MAKE_MEM_UNDEFINED (void *addr, 00045 size_t len) 00046 { 00047 return 0; 00048 } 00049 00050 static inline int 00051 VALGRIND_PRINTF (const char *format, 00052 ...) 00053 { 00054 return 0; 00055 } 00056 00057 static inline int 00058 VALGRIND_PRINTF_BACKTRACE (const char *format, 00059 ...) 00060 { 00061 return 0; 00062 } 00063 00064 # define RUNNING_ON_VALGRIND 0 00065 #endif /* WITH_VALGRIND */ 00066 00067 #endif /* header guard */