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

Commit7ba7986

Browse files
committed
Fix interaction of Perl and stdbool.h
Revert the PL/Perl-specific change in9a95a77. We must not prevent Perl fromusing stdbool.h when it has been built to do so, even if it uses anincompatible size. Otherwise, we would be imposing our bool on Perl,which will lead to crashes because of the size mismatch.Instead, we undef bool after including the Perl headers, as we didpreviously, but now only if we are not using stdbool.h ourselves.Record that choice in c.h as USE_STDBOOL. This will also make it easierto apply that coding pattern elsewhere if necessary.
1 parentf1a074b commit7ba7986

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

‎src/include/c.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268

269269
#if defined(HAVE_STDBOOL_H)&&SIZEOF_BOOL==1
270270
#include<stdbool.h>
271+
#defineUSE_STDBOOL 1
271272
#else
272273

273274
#ifndefbool

‎src/pl/plperl/plperl.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@
5050
#define__inline__ inline
5151
#endif
5252

53-
/*
54-
* Prevent perl from redefining "bool".
55-
*/
56-
#defineHAS_BOOL 1
57-
5853

5954
/*
6055
* Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
@@ -96,6 +91,19 @@
9691
#defineNEED_sv_2pv_flags
9792
#include"ppport.h"
9893

94+
/*
95+
* perl might have included stdbool.h. If we also did that earlier (see c.h),
96+
* then that's fine. If not, we probably rejected it for some reason. In
97+
* that case, undef bool and proceed with our own bool. (Note that stdbool.h
98+
* makes bool a macro, but our own replacement is a typedef, so the undef
99+
* makes ours visible again).
100+
*/
101+
#ifndefUSE_STDBOOL
102+
#ifdefbool
103+
#undef bool
104+
#endif
105+
#endif
106+
99107
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
100108
#ifndefHeUTF8
101109
#defineHeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp