In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/8b08c4b951d7e6689c8f58393e1615af86a573d2?hp=1b3da025c55a48511e8e3b0b8b4cfd716c047d83>
- Log ----------------------------------------------------------------- commit 8b08c4b951d7e6689c8f58393e1615af86a573d2 Author: Steve Hay <[email protected]> Date: Tue Jan 27 08:52:17 2015 +0000 perldelta for f9bbfafdab M pod/perldelta.pod commit f9bbfafdab6ec76ff269d0f3959152d03d0272d0 Author: Steve Hay <[email protected]> Date: Thu Jan 22 13:47:42 2015 +0000 Add USE_CPLUSPLUS build option to win32 makefiles With thanks to Craig A. Berry and Daniel Dragan for finding the d_cplusplus and extern_C options, respectively. M win32/Makefile M win32/config_sh.PL M win32/makefile.mk commit 7e23982e45ede7c6810c2b6e5435dd8f854f13cf Author: Steve Hay <[email protected]> Date: Tue Jan 27 08:36:02 2015 +0000 Merge upstream fix for C++ mode build of Win32API-File This is so we can have C++ mode builds on Windows without having to wait for a new CPAN release of Win32API-File. M Porting/Maintainers.pl M cpan/Win32API-File/File.pm M cpan/Win32API-File/File.xs M t/porting/customized.dat commit 0563a5d0dbc2057bd72b3c885c6056f7307808d9 Author: Steve Hay <[email protected]> Date: Tue Jan 27 08:27:10 2015 +0000 Functions marked 'b' in embed.fnc MUST be implemented in mathoms.c This was effectively changed from 'often' to 'must be' by commit 075eb5c9b6. M embed.fnc commit 97fc4b2276a06ffe98ef1f015aab47ad55250643 Author: Steve Hay <[email protected]> Date: Tue Jan 27 08:23:33 2015 +0000 Remove out-dated comment from mathoms.c The previous commit did not honour this comment, and was evidently not the first to have not seen it either: at least 09d7a3ba91 and 0d7d409d8d have already added new functions in the 'wrong' place, so just remove the comment. M mathoms.c commit e4524c4c2a2abf2b0b0a22c933ef56ed5d17f89e Author: Daniel Dragan <[email protected]> Date: Tue Jan 20 07:51:13 2015 -0500 move functions marked as mathomed in embed.fnc to mathoms.c Ever since commit 075eb5c9b6 mathom functions must be in mathoms.c for their symbols to be skipped in makedef.pl on Win32 Perl. If a function is marked 'b' in embed.fnc, regen.pl does NOT add its prototype to proto.h (it is commented out). Without the proto.h entry, EXTERN_C will be missing and a -DNO_MATHOMS + C++ Win32 Perl build will not link, since the C function will have a mangled name and the symbol will not be found for creating the perl linking library. Also add EXTERN_C to Win32CORE, the init_Win32CORE symbol is special cased for exporting in makedef.pl. Perl_is_utf8_char_buf was marked as 'b' in commit 3cedd9d930 Perl_sv_copypv was marked as 'b' in commit 4bac9ae47b M ext/Win32CORE/Win32CORE.c M mathoms.c M sv.c M utf8.c ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 3 +++ cpan/Win32API-File/File.pm | 2 +- cpan/Win32API-File/File.xs | 11 ++++++----- embed.fnc | 4 ++-- ext/Win32CORE/Win32CORE.c | 2 ++ mathoms.c | 26 ++++++++++++++++++++++++-- pod/perldelta.pod | 5 +++-- sv.c | 8 -------- t/porting/customized.dat | 2 ++ utf8.c | 16 ---------------- win32/Makefile | 15 +++++++++++++++ win32/config_sh.PL | 5 +++++ win32/makefile.mk | 20 +++++++++++++++++++- 13 files changed, 82 insertions(+), 37 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 4b37146..28a49ad 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1291,6 +1291,9 @@ use File::Glob qw(:case); qr{^ex/}, 't/pod.t', ], + # Already merged upstream: + # https://github.com/chorny/Win32API-File/commit/1657e97900 + 'CUSTOMIZED' => [qw(File.pm File.xs)], }, 'XSLoader' => { diff --git a/cpan/Win32API-File/File.pm b/cpan/Win32API-File/File.pm index 03b736e..bf2d531 100644 --- a/cpan/Win32API-File/File.pm +++ b/cpan/Win32API-File/File.pm @@ -10,7 +10,7 @@ use Fcntl qw( O_RDONLY O_RDWR O_WRONLY O_APPEND O_BINARY O_TEXT ); use vars qw( $VERSION @ISA ); use vars qw( @EXPORT @EXPORT_OK @EXPORT_FAIL %EXPORT_TAGS ); -$VERSION= '0.1201'; +$VERSION= '0.1201_01'; use base qw( Exporter DynaLoader Tie::Handle IO::File ); diff --git a/cpan/Win32API-File/File.xs b/cpan/Win32API-File/File.xs index cff488f..83971d0 100644 --- a/cpan/Win32API-File/File.xs +++ b/cpan/Win32API-File/File.xs @@ -148,7 +148,7 @@ CreateFileA( sPath, uAccess, uShare, pSecAttr, uCreate, uFlags, hModel ) HANDLE hModel CODE: RETVAL= CreateFileA( sPath, uAccess, uShare, - pSecAttr, uCreate, uFlags, hModel ); + (LPSECURITY_ATTRIBUTES)pSecAttr, uCreate, uFlags, hModel ); if( INVALID_HANDLE_VALUE == RETVAL ) { SaveErr( 1 ); XSRETURN_NO; @@ -170,7 +170,7 @@ CreateFileW( swPath, uAccess, uShare, pSecAttr, uCreate, uFlags, hModel ) HANDLE hModel CODE: RETVAL= CreateFileW( swPath, uAccess, uShare, - pSecAttr, uCreate, uFlags, hModel ); + (LPSECURITY_ATTRIBUTES)pSecAttr, uCreate, uFlags, hModel ); if( INVALID_HANDLE_VALUE == RETVAL ) { SaveErr( 1 ); XSRETURN_NO; @@ -246,7 +246,7 @@ DeviceIoControl( hDevice, uIoControlCode, pInBuf, lInBuf, opOutBuf, lOutBuf, olR } grow_buf_l( opOutBuf,ST(4),char *, lOutBuf,ST(5) ); RETVAL= DeviceIoControl( hDevice, uIoControlCode, pInBuf, lInBuf, - opOutBuf, lOutBuf, &olRetBytes, pOverlapped ); + opOutBuf, lOutBuf, &olRetBytes, (LPOVERLAPPED)pOverlapped ); SaveErr( !RETVAL ); OUTPUT: RETVAL @@ -553,7 +553,8 @@ ReadFile( hFile, opBuffer, lBytes, olBytesRead, pOverlapped ) if( 0 == lBytes && autosize(ST(2)) ) { lBytes= SvLEN( ST(1) ) - 1; } - RETVAL= ReadFile( hFile, opBuffer, lBytes, &olBytesRead, pOverlapped ); + RETVAL= ReadFile( hFile, opBuffer, lBytes, &olBytesRead, + (LPOVERLAPPED)pOverlapped ); SaveErr( !RETVAL ); OUTPUT: RETVAL @@ -640,7 +641,7 @@ WriteFile( hFile, pBuffer, lBytes, ouBytesWritten, pOverlapped ) "Win32API::File::WriteFile", SvCUR(ST(1)), lBytes ); } RETVAL= WriteFile( hFile, pBuffer, lBytes, - &ouBytesWritten, pOverlapped ); + &ouBytesWritten, (LPOVERLAPPED)pOverlapped ); SaveErr( !RETVAL ); OUTPUT: RETVAL diff --git a/embed.fnc b/embed.fnc index 71a6487..88cb1c3 100644 --- a/embed.fnc +++ b/embed.fnc @@ -28,9 +28,9 @@ : proto.h: add __attribute__malloc__ : : b Binary backward compatibility; function is a macro -: but has also Perl_ implementation (which is exported); often +: but has also Perl_ implementation (which is exported); must be : implemented in mathoms.c (whose compilation can be suppressed; see -: INSTALL): +: INSTALL) as commit 075eb5c9b6: : : add entry to the list of exported symbols; : don't define PERL_ARGS_ASSERT_FOO diff --git a/ext/Win32CORE/Win32CORE.c b/ext/Win32CORE/Win32CORE.c index 64104d3..524cf3f 100644 --- a/ext/Win32CORE/Win32CORE.c +++ b/ext/Win32CORE/Win32CORE.c @@ -47,6 +47,8 @@ XS_EXTERNAL(boot_Win32CORE) * should never be called though, as Win32CORE.pm doesn't use DynaLoader. */ } + +EXTERN_C #if !defined(__CYGWIN__) || defined(USEIMPORTLIB) __declspec(dllexport) #endif diff --git a/mathoms.c b/mathoms.c index 96b3ac3..2a65fb4 100644 --- a/mathoms.c +++ b/mathoms.c @@ -1019,8 +1019,6 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags) NULL, 0)); } -/* Functions after here were made mathoms post 5.10.0 but pre 5.8.9 */ - AV * Perl_newAV(pTHX) { @@ -1217,6 +1215,14 @@ Perl_sv_mortalcopy(pTHX_ SV *const oldstr) return Perl_sv_mortalcopy_flags(aTHX_ oldstr, SV_GMAGIC); } +void +Perl_sv_copypv(pTHX_ SV *const dsv, SV *const ssv) +{ + PERL_ARGS_ASSERT_SV_COPYPV; + + sv_copypv_flags(dsv, ssv, 0); +} + UV /* Made into a function, so can be deprecated */ NATIVE_TO_NEED(const UV enc, const UV ch) { @@ -1695,6 +1701,22 @@ Perl_is_utf8_char(const U8 *s) return isUTF8_CHAR(s, s + UTF8SKIP(s)); } +/* +=for apidoc is_utf8_char_buf + +This is identical to the macro L</isUTF8_CHAR>. + +=cut */ + +STRLEN +Perl_is_utf8_char_buf(const U8 *buf, const U8* buf_end) +{ + + PERL_ARGS_ASSERT_IS_UTF8_CHAR_BUF; + + return isUTF8_CHAR(buf, buf_end); +} + /* DEPRECATED! * Like L</utf8_to_uvuni_buf>(), but should only be called when it is known that * there are no malformations in the input UTF-8 string C<s>. Surrogates, diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 8bbc849..d4f3ce2 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -325,9 +325,10 @@ L</Modules and Pragmata> section. =over 4 -=item XXX-some-platform +=item Windows -XXX +Perl can now be built in C++ mode on Windows by setting the makefile macro +C<USE_CPLUSPLUS> to the value "define". =back diff --git a/sv.c b/sv.c index d936dfc..1e85a72 100644 --- a/sv.c +++ b/sv.c @@ -3250,14 +3250,6 @@ include SV_GMAGIC. */ void -Perl_sv_copypv(pTHX_ SV *const dsv, SV *const ssv) -{ - PERL_ARGS_ASSERT_SV_COPYPV; - - sv_copypv_flags(dsv, ssv, 0); -} - -void Perl_sv_copypv_flags(pTHX_ SV *const dsv, SV *const ssv, const I32 flags) { STRLEN len; diff --git a/t/porting/customized.dat b/t/porting/customized.dat index 9bde2de..d32b788 100644 --- a/t/porting/customized.dat +++ b/t/porting/customized.dat @@ -13,6 +13,8 @@ Text::Balanced cpan/Text-Balanced/t/08_extvar.t 0776ef2cbdad5b1fbefb300541d07921 Text::Balanced cpan/Text-Balanced/t/09_gentag.t 42361b5dfb3bb728bce20f4fb0d92ccfb27c2ba7 Text::ParseWords cpan/Text-ParseWords/t/ParseWords.t 9bae51c9b944cd5c0bbabe9d397e573976a2be8e Text::ParseWords cpan/Text-ParseWords/t/taint.t 3cff0dae812801f7aa1738d6070508f2c5bcc2e5 +Win32API::File cpan/Win32API-File/File.pm 91709e8f13b262807816e727e678c9e322bf6d41 +Win32API::File cpan/Win32API-File/File.xs 772b60e157d8d617715b93775e868686554a5a69 podlators cpan/podlators/scripts/pod2man.PL f81acf53f3ff46cdcc5ebdd661c5d13eb35d20d6 podlators cpan/podlators/scripts/pod2text.PL b4693fcfe4a0a1b38a215cfb8985a65d5d025d69 threads dist/threads/lib/threads.pm e1b210ff6d66a0e1d43aa8f040954fc811e3d250 diff --git a/utf8.c b/utf8.c index 8182e63..bf5a36e 100644 --- a/utf8.c +++ b/utf8.c @@ -319,22 +319,6 @@ Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) } /* -=for apidoc is_utf8_char_buf - -This is identical to the macro L</isUTF8_CHAR>. - -=cut */ - -STRLEN -Perl_is_utf8_char_buf(const U8 *buf, const U8* buf_end) -{ - - PERL_ARGS_ASSERT_IS_UTF8_CHAR_BUF; - - return isUTF8_CHAR(buf, buf_end); -} - -/* =for apidoc is_utf8_string Returns true if the first C<len> bytes of string C<s> form a valid diff --git a/win32/Makefile b/win32/Makefile index 71481b5..8076ce6 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -133,6 +133,11 @@ CCTYPE = MSVC60 #__ICC = define # +# Uncomment this if you want to build everything in C++ mode +# +#USE_CPLUSPLUS = define + +# # uncomment next line if you want debug version of perl (big,slow) # If not enabled, we automatically try to use maximum optimization # with all compilers that are known to have a working optimizer. @@ -505,6 +510,9 @@ EXTRACFLAGS = -nologo -GF -W3 !IF "$(__ICC)" == "define" EXTRACFLAGS = $(EXTRACFLAGS) -Qstd=c99 !ENDIF +!IF "$(USE_CPLUSPLUS)" == "define" +EXTRACFLAGS = $(EXTRACFLAGS) $(CXX_FLAG) +!ENDIF CFLAGS = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \ $(PCHFLAGS) $(OPTIMIZE) LINK_FLAGS = -nologo -nodefaultlib $(LINK_DBG) \ @@ -791,6 +799,7 @@ CFG_VARS = \ "cc=$(CC)" \ "ld=$(LINK32)" \ "ccflags=$(EXTRACFLAGS) $(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)" \ + "usecplusplus=$(USE_CPLUSPLUS)" \ "cf_email=$(EMAIL)" \ "d_mymalloc=$(PERL_MALLOC)" \ "libs=$(LIBFILES)" \ @@ -879,6 +888,7 @@ config.w32 : $(CFGSH_TMPL) @echo #undef UVXf>>$@ @echo #undef USE_64_BIT_INT>>$@ @echo #undef Size_t_size>>$@ + @echo #undef USE_CPLUSPLUS>>$@ !IF "$(USE_LARGE_FILES)"=="define" @echo #define Off_t __int64>>$@ @echo #define LSEEKSIZE ^8>>$@ @@ -930,6 +940,11 @@ config.w32 : $(CFGSH_TMPL) @echo #define UVXf "lX">>$@ @echo #undef USE_64_BIT_INT>>$@ !ENDIF +!IF "$(USE_CPLUSPLUS)"=="define" + @echo #define USE_CPLUSPLUS>>$@ +!ELSE + @echo #undef USE_CPLUSPLUS>>$@ +!ENDIF @echo #endif>>$@ ..\git_version.h : $(MINIPERL) ..\make_patchnum.pl diff --git a/win32/config_sh.PL b/win32/config_sh.PL index 60fb4ed..98255a8 100644 --- a/win32/config_sh.PL +++ b/win32/config_sh.PL @@ -286,6 +286,11 @@ if ($opt{useithreads} eq 'define' && $opt{ccflags} =~ /-DPERL_IMPLICIT_SYS\b/) { $opt{d_pseudofork} = 'define'; } +if ($opt{usecplusplus} eq 'define') { + $opt{d_cplusplus} = 'define'; + $opt{extern_C} = 'extern "C"'; +} + #if the fields above are defined, they override the defaults in the premade #config file while (<>) { diff --git a/win32/makefile.mk b/win32/makefile.mk index 5ca5caa..f275a8e 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -153,6 +153,11 @@ CCTYPE *= GCC #__ICC *= define # +# Uncomment this if you want to build everything in C++ mode +# +#USE_CPLUSPLUS *= define + +# # uncomment next line if you want debug version of perl (big,slow) # If not enabled, we automatically try to use maximum optimization # with all compilers that are known to have a working optimizer. @@ -481,6 +486,9 @@ LINK_DBG = -s .ENDIF EXTRACFLAGS = +.IF "$(USE_CPLUSPLUS)" == "define" +EXTRACFLAGS += $(CXX_FLAG) +.ENDIF CFLAGS = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE) LINK_FLAGS = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)" OBJOUT_FLAG = -o @@ -612,7 +620,10 @@ LIBFILES = $(LIBBASEFILES) $(LIBC) EXTRACFLAGS = -nologo -GF -W3 .IF "$(__ICC)" == "define" -EXTRACFLAGS = $(EXTRACFLAGS) -Qstd=c99 +EXTRACFLAGS += -Qstd=c99 +.ENDIF +.IF "$(USE_CPLUSPLUS)" == "define" +EXTRACFLAGS += $(CXX_FLAG) .ENDIF CFLAGS = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \ $(PCHFLAGS) $(OPTIMIZE) @@ -937,6 +948,7 @@ CFG_VARS = \ cc=$(CC) ~ \ ld=$(LINK32) ~ \ ccflags=$(EXTRACFLAGS) $(OPTIMIZE) $(DEFINES) $(BUILDOPT) ~ \ + usecplusplus=$(USE_CPLUSPLUS) ~ \ cf_email=$(EMAIL) ~ \ d_mymalloc=$(PERL_MALLOC) ~ \ libs=$(LIBFILES:f) ~ \ @@ -1062,6 +1074,7 @@ config.w32 : $(CFGSH_TMPL) @echo #undef NVff>>$@ @echo #undef NVgf>>$@ @echo #undef USE_LONG_DOUBLE>>$@ + @echo #undef USE_CPLUSPLUS>>$@ .IF "$(USE_LARGE_FILES)"=="define" @echo #define Off_t $(INT64)>>$@ @echo #define LSEEKSIZE ^8>>$@ @@ -1164,6 +1177,11 @@ config.w32 : $(CFGSH_TMPL) @echo #define NVgf "g">>$@ @echo #undef USE_LONG_DOUBLE>>$@ .ENDIF +.IF "$(USE_CPLUSPLUS)"=="define" + @echo #define USE_CPLUSPLUS>>$@ +.ELSE + @echo #undef USE_CPLUSPLUS>>$@ +.ENDIF @echo #endif>>$@ ..\git_version.h : $(MINIPERL) ..\make_patchnum.pl -- Perl5 Master Repository
