diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index 5eaec73d2b..a375bb5e31 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -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