New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Finish mathomizing Perl_instr #15265
Comments
From @craigberrySending to the list because of code freeze, but I think it should be a 5.24.0 blocker since it fixes a new problem we created within the last month. Patch inline and attached. From 0ecbc6fd5c28fca6e5585e13fc2a9a4cfd56ecd2 Mon Sep 17 00:00:00 2001 fea1d2d turned instr into a macro. It also left the A function compiled without a prototype under C++ does not get So move the function into mathoms.c and put its prototype in the We also have to fake the PERL_ARGS_ASSERT_INSTR macro since its mathoms.c | 20 ++++++++++++++++++++ Inline Patchdiff --git a/mathoms.c b/mathoms.c
index 3187782..d530cc0 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -107,6 +107,9 @@ PERL_CALLCONV UV Perl_to_utf8_title(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_fold(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV SV *Perl_sv_mortalcopy(pTHX_ SV *const oldstr);
+PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
+ __attribute__warn_unused_result__
+ __attribute__pure__;
/* ref() is now a macro using Perl_doref;
* this version provided for binary compatibility only.
@@ -1808,6 +1811,23 @@ Perl_pad_compname_type(pTHX_ const PADOFFSET po)
return PAD_COMPNAME_TYPE(po);
}
+/* now a macro */
+/* return ptr to little string in big string, NULL if not found */
+/* This routine was donated by Corey Satten. */
+
+char *
+Perl_instr(const char *big, const char *little)
+{
+ /* Porting tests require this macro to be used even though it doesn't exist
+ * (except for the commented-out version in proto.h). So provide a commented-out
+ * "use" of the prototype and supply a real version of what it expanded to.
+ PERL_ARGS_ASSERT_INSTR;
+ */
+ assert(big);
+ assert(little);
+
+ return strstr((char*)big, (char*)little);
+}
END_EXTERN_C
diff --git a/util.c b/util.c
index 89c44e7..447a19f 100644
--- a/util.c
+++ b/util.c
@@ -551,18 +551,6 @@ Perl_delimcpy(char *to, const char *toend, const char *from, const char *fromend
return (char *)from;
}
-/* return ptr to little string in big string, NULL if not found */
-/* This routine was donated by Corey Satten. */
-
-char *
-Perl_instr(const char *big, const char *little)
-{
-
- PERL_ARGS_ASSERT_INSTR;
-
- return strstr((char*)big, (char*)little);
-}
-
/*
=head1 Miscellaneous Functions
$ perl -"V" Characteristics of this PERLSHR image: |
From @craigberry0001-Finish-mathomizing-Perl_instr.patchFrom 0ecbc6fd5c28fca6e5585e13fc2a9a4cfd56ecd2 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <craigberry@mac.com>
Date: Wed, 6 Apr 2016 20:59:12 -0500
Subject: [PATCH] Finish mathomizing Perl_instr.
fea1d2dd5d210564d4 turned instr into a macro. It also left the
actual function in util.c while commenting out the prototype
in proto.h (via the m flag in embed.fnc).
A function compiled without a prototype under C++ does not get
declared with extern "C" and thus gets mangled, which breaks the
build with a strict linker (VMS, possibly AIX) because the
expected symbol name is no longer produced. Without a strict
linker, it just breaks the binary compatibility that was presumably
the nominal reason for leaving the function around in the first
place.
So move the function into mathoms.c and put its prototype in the
extern "C"-guarded section at the top of the same file.
We also have to fake the PERL_ARGS_ASSERT_INSTR macro since its
original declaration in proto.h is commented out but the porting
test t/porting/args_assert.t will take revenge if it doesn't
find the macro being used somewhere.
---
mathoms.c | 20 ++++++++++++++++++++
util.c | 12 ------------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/mathoms.c b/mathoms.c
index 3187782..d530cc0 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -107,6 +107,9 @@ PERL_CALLCONV UV Perl_to_utf8_title(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_fold(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV SV *Perl_sv_mortalcopy(pTHX_ SV *const oldstr);
+PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
+ __attribute__warn_unused_result__
+ __attribute__pure__;
/* ref() is now a macro using Perl_doref;
* this version provided for binary compatibility only.
@@ -1808,6 +1811,23 @@ Perl_pad_compname_type(pTHX_ const PADOFFSET po)
return PAD_COMPNAME_TYPE(po);
}
+/* now a macro */
+/* return ptr to little string in big string, NULL if not found */
+/* This routine was donated by Corey Satten. */
+
+char *
+Perl_instr(const char *big, const char *little)
+{
+ /* Porting tests require this macro to be used even though it doesn't exist
+ * (except for the commented-out version in proto.h). So provide a commented-out
+ * "use" of the prototype and supply a real version of what it expanded to.
+ PERL_ARGS_ASSERT_INSTR;
+ */
+ assert(big);
+ assert(little);
+
+ return strstr((char*)big, (char*)little);
+}
END_EXTERN_C
diff --git a/util.c b/util.c
index 89c44e7..447a19f 100644
--- a/util.c
+++ b/util.c
@@ -551,18 +551,6 @@ Perl_delimcpy(char *to, const char *toend, const char *from, const char *fromend
return (char *)from;
}
-/* return ptr to little string in big string, NULL if not found */
-/* This routine was donated by Corey Satten. */
-
-char *
-Perl_instr(const char *big, const char *little)
-{
-
- PERL_ARGS_ASSERT_INSTR;
-
- return strstr((char*)big, (char*)little);
-}
-
/*
=head1 Miscellaneous Functions
--
2.2.1
|
From @khwilliamsonOn 04/07/2016 06:08 AM, Craig A. Berry (via RT) wrote:
Maybe we should just revert that for 5.24
|
The RT System itself - Status changed from 'new' to 'open' |
From @craigberry
That works for me. I wasn’t sure if anything else depended on it. |
From @khwilliamsonThis was re-inserted in blead in and the special cases needed were removed, once the infrastructure was in place, |
@khwilliamson - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127852 (status was 'resolved')
Searchable as RT127852$
The text was updated successfully, but these errors were encountered: