mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
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.
This commit is contained in:
parent
7e0f8f836d
commit
7762288744
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user