From fa36b45bfafec663e49639d40f4671e018e7ee10 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 4 Jun 2018 00:10:12 +0200 Subject: [PATCH] Stop poisoning function in debug mode This breaks when external headers use those functions. Fixes #2769 --- src/daemon/collectd.h | 20 -------------------- src/lua.c | 13 ++----------- src/perl.c | 10 ---------- src/utils_lua.c | 4 ---- src/utils_lua.h | 5 +---- 5 files changed, 3 insertions(+), 49 deletions(-) diff --git a/src/daemon/collectd.h b/src/daemon/collectd.h index 87f05a23..459da4dc 100644 --- a/src/daemon/collectd.h +++ b/src/daemon/collectd.h @@ -240,26 +240,6 @@ #define __attribute__(x) /**/ #endif -#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__ -#undef strcpy -#undef strcat -#undef strtok -#pragma GCC poison strcpy strcat strtok -#endif - -/* - * Special hack for the perl plugin: Because the later included perl.h defines - * a macro which is never used, but contains `sprintf', we cannot poison that - * identifies just yet. The parl plugin will do that itself once perl.h is - * included. - */ -#ifndef DONT_POISON_SPRINTF_YET -#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__ -#undef sprintf -#pragma GCC poison sprintf -#endif -#endif - #ifndef GAUGE_FORMAT #define GAUGE_FORMAT "%.15g" #endif diff --git a/src/lua.c b/src/lua.c index 8cfb7045..f66d8526 100644 --- a/src/lua.c +++ b/src/lua.c @@ -28,27 +28,18 @@ * Ruben Kerkhof **/ -/* defines a macro using "sprintf". Although not used here, - * GCC will complain about the macro definition. */ -#define DONT_POISON_SPRINTF_YET - +#include "collectd.h" #include "common.h" #include "plugin.h" -#include "collectd.h" +#include "utils_lua.h" /* Include the Lua API header files. */ #include #include #include -#include "utils_lua.h" #include -#if COLLECT_DEBUG && __GNUC__ -#undef sprintf -#pragma GCC poison sprintf -#endif - typedef struct lua_script_s { char *script_path; lua_State *lua_state; diff --git a/src/perl.c b/src/perl.c index 306d4138..31c68ad7 100644 --- a/src/perl.c +++ b/src/perl.c @@ -33,21 +33,11 @@ /* do not automatically get the thread specific Perl interpreter */ #define PERL_NO_GET_CONTEXT -#define DONT_POISON_SPRINTF_YET 1 -#include "collectd.h" - -#undef DONT_POISON_SPRINTF_YET - #include #include #include -#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__ -#undef sprintf -#pragma GCC poison sprintf -#endif - #include /* Some versions of Perl define their own version of DEBUG... :-/ */ diff --git a/src/utils_lua.c b/src/utils_lua.c index 1f060f84..11ac0010 100644 --- a/src/utils_lua.c +++ b/src/utils_lua.c @@ -24,10 +24,6 @@ * Florian Forster **/ -/* defines a macro using "sprintf". Although not used here, - * GCC will complain about the macro definition. */ -#define DONT_POISON_SPRINTF_YET - #include "common.h" #include "utils_lua.h" diff --git a/src/utils_lua.h b/src/utils_lua.h index 61d9070e..e5a3d746 100644 --- a/src/utils_lua.h +++ b/src/utils_lua.h @@ -27,12 +27,9 @@ #ifndef UTILS_LUA_H #define UTILS_LUA_H 1 -#include "plugin.h" #include "collectd.h" +#include "plugin.h" -#ifndef DONT_POISON_SPRINTF_YET -#error "Files including utils_lua.h need to define DONT_POISON_SPRINTF_YET." -#endif #include /* -- 2.11.0