This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tweak the cBOOL() macro to avoid problems with the AIX compiler.
[perl5.git] / handy.h
diff --git a/handy.h b/handy.h
index 7a87d78..8777644 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -115,9 +115,10 @@ Null SV pointer. (No longer available when C<PERL_CORE> is defined.)
 
 /* a simple (bool) cast may not do the right thing: if bool is defined
  * as char for example, then the cast from int is implementation-defined
+ * (bool)!!(cbool) in a ternary triggers a bug in xlc on AIX
  */
 
-#define cBOOL(cbool) ((bool)!!(cbool))
+#define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0)
 
 /* Try to figure out __func__ or __FUNCTION__ equivalent, if any.
  * XXX Should really be a Configure probe, with HAS__FUNCTION__
@@ -919,7 +920,7 @@ EXTCONST U32 PL_charclass[];
  * the function.  This relies on the fact that ASCII characters have the same
  * representation whether utf8 or not */
 #define generic_utf8(macro, function, p) (isASCII(*(p))                        \
-                                         ? CAT2(macro, _A)(*(p))               \
+                                         ? CAT2(CAT2(macro,_),A)(*(p))               \
                                          : (UTF8_IS_DOWNGRADEABLE_START(*(p))) \
                                            ? CAT2(macro, _L1)                  \
                                              (TWO_BYTE_UTF8_TO_UNI(*(p),       \
@@ -941,7 +942,7 @@ EXTCONST U32 PL_charclass[];
                                 : (UTF8_IS_DOWNGRADEABLE_START(*(p)))           \
                                   ? isIDFIRST_L1(TWO_BYTE_UTF8_TO_UNI(*(p),     \
                                                                       *((p)+1)))\
-                                  : _is_utf8__perl_idstart(p))
+                                  : Perl__is_utf8__perl_idstart(aTHX_ p))
 #define isIDCONT_utf8(p)       generic_utf8(isWORDCHAR, is_utf8_xidcont, p)
 #define isALPHA_utf8(p)                generic_utf8(isALPHA, is_utf8_alpha, p)
 #define isSPACE_utf8(p)                generic_utf8(isSPACE, is_utf8_space, p)