From: Ruben Kerkhof Date: Sun, 3 Jun 2018 22:10:12 +0000 (+0200) Subject: Stop poisoning function in debug mode X-Git-Tag: collectd-5.9.0~190^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa36b45bfafec663e49639d40f4671e018e7ee10;p=thirdparty%2Fcollectd.git Stop poisoning function in debug mode This breaks when external headers use those functions. Fixes #2769 --- diff --git a/src/daemon/collectd.h b/src/daemon/collectd.h index 87f05a23a..459da4dcb 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 8cfb70459..f66d85263 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 306d4138a..31c68ad78 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 1f060f84e..11ac00106 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 61d9070eb..e5a3d7467 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 /*