Subject: | Patch to remove impediment to compiling under C++11 |
See attached patch
Subject: | 0009-Rmv-impediment-to-compiling-under-C-11.patch |
From 33aa65c5b946d77a73cf78e0cd09430191dd912a Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Sat, 19 Nov 2016 16:34:25 -0700
Subject: [PATCH 9/9] Rmv impediment to compiling under C++11
C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language. Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).
Although not required by the C++11 change, this patch also makes sure
there is space after a macro call, before a string literal. This makes
the macro stand out, and is easier to read. As part of this, useless ""
following the macro are removed.
This patch also changes the affected lines to not exceed 79 columns, as
specified by perlhack.
Code and modules included with the Perl core need to be compilable using
C++. This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.) So we need to accommodate
changes to the C++ language.
---
vutil.h | 2 +-
vxs.inc | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/vutil.h b/vutil.h
index a60ca9d..e291408 100644
--- a/vutil.h
+++ b/vutil.h
@@ -115,7 +115,7 @@ S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
} else {
/* Pants. I don't think that it should be possible to get here. */
- Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
+ Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
}
}
diff --git a/vxs.inc b/vxs.inc
index d246837..e74f2c4 100644
--- a/vxs.inc
+++ b/vxs.inc
@@ -138,7 +138,7 @@ VXS(universal_version)
name, SvPVx_nolen_const(req));
#else
Perl_croak(aTHX_
- "%"HEKf" does not define $%"HEKf
+ "%" HEKf " does not define $%"HEKf
"::VERSION--version check failed",
HEKfARG(name), HEKfARG(name));
#endif
@@ -146,7 +146,8 @@ VXS(universal_version)
else {
#if PERL_VERSION >= 8
Perl_croak(aTHX_
- "%"SVf" defines neither package nor VERSION--version check failed",
+ "%" SVf " defines neither package nor VERSION--"
+ "version check failed",
(void*)(ST(0)) );
#else
Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed",
@@ -170,8 +171,8 @@ VXS(universal_version)
req = VSTRINGIFY(req);
sv = VSTRINGIFY(sv);
}
- Perl_croak(aTHX_ "%"HEKf" version %"SVf" required--"
- "this is only version %"SVf"", HEKfARG(HvNAME_HEK(pkg)),
+ Perl_croak(aTHX_ "%" HEKf " version %" SVf " required--"
+ "this is only version %" SVf, HEKfARG(HvNAME_HEK(pkg)),
SVfARG(sv_2mortal(req)),
SVfARG(sv_2mortal(sv)));
}
--
2.7.4