summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-01-12 22:31:07 -0700
committerKarl Williamson <khw@cpan.org>2015-01-13 12:19:59 -0700
commit2726666d48c2d6d699d0a840da6e9f7a2fdfde22 (patch)
tree18606efa6f54293d89585b056977a63c44b41ab7 /perl.h
parentc0f3a893f19a236736869b0203e771705a22d986 (diff)
downloadperl-2726666d48c2d6d699d0a840da6e9f7a2fdfde22.tar.gz
Move unlikely executed macro to function
The bulk of this macro is extremely rarely executed, so it makes sense to optimize for space, as it is called from a fair number of places, and move as much as possible to a single function. For whatever it's worth, on my system with my typical compilation options, including -O0, the savings was 19640 bytes in regexec.o, 4528 in utf8.o, at a cost of 1488 in locale.o.
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/perl.h b/perl.h
index 2d3e1f769d..09a1de229e 100644
--- a/perl.h
+++ b/perl.h
@@ -5796,17 +5796,14 @@ typedef struct am_table_short AMTS;
/* This internal macro should be called from places that operate under
* locale rules. It there is a problem with the current locale that
- * hasn't been raised yet, it will output a warning this time */
+ * hasn't been raised yet, it will output a warning this time. Because
+ * this will so rarely be true, there is no point to optimize for
+ * time; instead it makes sense to minimize space used and do all the
+ * work in the rarely called function */
# define _CHECK_AND_WARN_PROBLEMATIC_LOCALE \
STMT_START { \
- if (PL_warn_locale) { \
- /*GCC_DIAG_IGNORE(-Wformat-security); Didn't work */ \
- Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), \
- SvPVX(PL_warn_locale), \
- 0 /* dummy to avoid comp warning */ ); \
- /* GCC_DIAG_RESTORE; */ \
- SvREFCNT_dec_NN(PL_warn_locale); \
- PL_warn_locale = NULL; \
+ if (UNLIKELY(PL_warn_locale)) { \
+ _warn_problematic_locale(); \
} \
} STMT_END