Commit 77622887 authored by Andrew Dunstan's avatar Andrew Dunstan

Prevent perl header overriding our *snprintf macros, and give it a usable PERL_UNUSED_DECL value.

This quiets compiler warnings about redefined macros and unused Perl__unused variables. The
redefinition of snprintf and vsnprintf is something we want to avoid anyway, if we've
gone to the bother of setting up the macros to point to our implementation.
parent 7e0f8f83
......@@ -26,11 +26,47 @@
#endif
#endif
/*
* Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
* perl itself supplies doesn't seem to.
*/
#if defined(__GNUC__)
#define PERL_UNUSED_DECL __attribute__ ((unused))
#endif
/*
* Sometimes perl carefully scribbles on our *printf macros.
* So we undefine them here and redefine them after it's done its dirty deed.
*/
#ifdef USE_REPL_SNPRINTF
#undef snprintf
#undef vsnprintf
#endif
/* required for perl API */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
/* put back our snprintf and vsnprintf */
#ifdef USE_REPL_SNPRINTF
#ifdef snprintf
#undef snprintf
#endif
#ifdef vsnprintf
#undef vsnprintf
#endif
#ifdef __GNUC__
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
#define snprintf(...) pg_snprintf(__VA_ARGS__)
#else
#define vsnprintf pg_vsnprintf
#define snprintf pg_snprintf
#endif /* __GNUC__ */
#endif /* USE_REPL_SNPRINTF */
/* perl version and platform portability */
#define NEED_eval_pv
#define NEED_newRV_noinc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment