]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Stop poisoning function in debug mode 2804/head
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 3 Jun 2018 22:10:12 +0000 (00:10 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 4 Jun 2018 13:00:38 +0000 (15:00 +0200)
This breaks when external headers use those functions.

Fixes #2769

src/daemon/collectd.h
src/lua.c
src/perl.c
src/utils_lua.c
src/utils_lua.h

index 87f05a23a215ea49b8bc3c8599f745a5e69981a6..459da4dcb40262e7f6edc45b6900b7e722557aa3 100644 (file)
 #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
index 8cfb70459991317048e6cdeb0b6be27146c95cdf..f66d852635e6fa9ecb0cdb06b82749795d11f0a3 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
  *   Ruben Kerkhof <ruben at rubenkerkhof.com>
  **/
 
-/* <lua5.1/luaconf.h> 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 <lauxlib.h>
 #include <lua.h>
 #include <lualib.h>
-#include "utils_lua.h"
 
 #include <pthread.h>
 
-#if COLLECT_DEBUG && __GNUC__
-#undef sprintf
-#pragma GCC poison sprintf
-#endif
-
 typedef struct lua_script_s {
   char *script_path;
   lua_State *lua_state;
index 306d4138a8fdbb9f0b0903ef4f0d3d638ff2e420..31c68ad78f4b03d72bdd3b853cf1689455ed333b 100644 (file)
 /* 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 <stdbool.h>
 
 #include <EXTERN.h>
 #include <perl.h>
 
-#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
-#undef sprintf
-#pragma GCC poison sprintf
-#endif
-
 #include <XSUB.h>
 
 /* Some versions of Perl define their own version of DEBUG... :-/ */
index 1f060f84e5001283f317b77e9cd318a5806ea266..11ac001061733ecd396cc0277d358928d5143b0d 100644 (file)
  *   Florian Forster <octo at collectd.org>
  **/
 
-/* <lua5.1/luaconf.h> 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"
 
index 61d9070ebe94f7516d94a6e35d2f2f84e4373d8a..e5a3d74677574c0e5de6397a3e696fc0591d9a64 100644 (file)
 #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 <lua.h>
 
 /*