Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7762288

Browse files
committed
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. Theredefinition of snprintf and vsnprintf is something we want to avoid anyway, if we'vegone to the bother of setting up the macros to point to our implementation.
1 parent7e0f8f8 commit7762288

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎src/pl/plperl/plperl.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,47 @@
2626
#endif
2727
#endif
2828

29+
/*
30+
* Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
31+
* perl itself supplies doesn't seem to.
32+
*/
33+
#if defined(__GNUC__)
34+
#definePERL_UNUSED_DECL __attribute__ ((unused))
35+
#endif
36+
37+
/*
38+
* Sometimes perl carefully scribbles on our *printf macros.
39+
* So we undefine them here and redefine them after it's done its dirty deed.
40+
*/
41+
42+
#ifdefUSE_REPL_SNPRINTF
43+
#undef snprintf
44+
#undef vsnprintf
45+
#endif
46+
47+
2948
/* required for perl API */
3049
#include"EXTERN.h"
3150
#include"perl.h"
3251
#include"XSUB.h"
3352

53+
/* put back our snprintf and vsnprintf */
54+
#ifdefUSE_REPL_SNPRINTF
55+
#ifdefsnprintf
56+
#undef snprintf
57+
#endif
58+
#ifdefvsnprintf
59+
#undef vsnprintf
60+
#endif
61+
#ifdef__GNUC__
62+
#definevsnprintf(...) pg_vsnprintf(__VA_ARGS__)
63+
#definesnprintf(...) pg_snprintf(__VA_ARGS__)
64+
#else
65+
#definevsnprintf pg_vsnprintf
66+
#definesnprintf pg_snprintf
67+
#endif/* __GNUC__ */
68+
#endif/* USE_REPL_SNPRINTF */
69+
3470
/* perl version and platform portability */
3571
#defineNEED_eval_pv
3672
#defineNEED_newRV_noinc

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp