In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/cd88b75a7a5146fdb4fac022b6d4bd40ce4accfc?hp=5c26a17602c4585ca111bd154f6c65c681cd0572>

- Log -----------------------------------------------------------------
commit cd88b75a7a5146fdb4fac022b6d4bd40ce4accfc
Author: Steve Hay <steve.m....@googlemail.com>
Date:   Thu Nov 1 13:43:39 2012 +0000

    Remove __attribute__malloc__ from MYSWAP functions
    
    These functions are only used when the native sockets functions are not
    available, e.g. when building miniperl on Windows following commit
    19253ae62c, so gcc's warning about ignoring the __malloc__ attribute here
    is not normally seen.
    
    The addition of "a" to these functions in embed.fnc by
    commit f54cb97a39 was presumably wrong since none of them actually
    allocate any memory (nor did so at the time), so change it to just "R"
    (which is implied by the "a" and is still appropriate).

M       embed.fnc
M       proto.h

commit 19253ae62cd130797cb3e42f196ac26a6417e08c
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Sat Oct 13 19:37:33 2012 -0400

    Win32 miniperl: delay loading for Winsock, and then remove it
    
    Slim down the image and speed up start up time for Win32 miniperl by
    removing Winsock. Also if the build process on Win32 in the future
    requires sockets, commenting one line in win32.h will turn sockets back on
    for miniperl, but this time with delay loading on VC Perl. The only casulty
    of no sockets for Win32 miniperl was figuring out the computer's name in
    win32/config_sh.PL. A workaround by using an ENV var was implemented. The
    purpose of this commit is to speed up the build process of Perl.
    
    As said in the comment in win32.h, the WIN32_NO_SOCKETS macro is
    incomplete in implementation. It is only removed winsock from being linked
    in in miniperl, not full Perl. PERL_IMPLICIT_SYS (specifically PerlSock in
    win32/perlhost.h) and makedef.pl's hard coded list of win32_* function
    exports cause winsock to still be linked in with even with
    WIN32_NO_SOCKETS on full perl. Both PERL_IMPLICIT_SYS (win32/perlhost.h)
    and makedef.pl would require changes to remove winsock from being linked
    in on full perl in the future.

M       win32/Makefile
M       win32/config_sh.PL
M       win32/makefile.mk
M       win32/win32.c
M       win32/win32.h
M       win32/win32sck.c
-----------------------------------------------------------------------

Summary of changes:
 embed.fnc          |    6 +++---
 proto.h            |    3 ---
 win32/Makefile     |    2 +-
 win32/config_sh.PL |    8 ++++++--
 win32/makefile.mk  |    2 +-
 win32/win32.c      |    8 ++++++++
 win32/win32.h      |   38 ++++++++++++++++++++++++++++++++++++--
 win32/win32sck.c   |   19 +++++++++++++++++++
 8 files changed, 74 insertions(+), 12 deletions(-)

diff --git a/embed.fnc b/embed.fnc
index 9fab558..3068905 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -841,9 +841,9 @@ Apmb        |I32    |my_stat
 pX     |I32    |my_stat_flags  |NULLOK const U32 flags
 Ap     |char * |my_strftime    |NN const char *fmt|int sec|int min|int 
hour|int mday|int mon|int year|int wday|int yday|int isdst
 #if defined(MYSWAP)
-ApPa   |short  |my_swap        |short s
-ApPa   |long   |my_htonl       |long l
-ApPa   |long   |my_ntohl       |long l
+ApPR   |short  |my_swap        |short s
+ApPR   |long   |my_htonl       |long l
+ApPR   |long   |my_ntohl       |long l
 #endif
 : Used in pp_ctl.c
 p      |void   |my_unexec
diff --git a/proto.h b/proto.h
index d069792..4bfa724 100644
--- a/proto.h
+++ b/proto.h
@@ -5227,17 +5227,14 @@ PERL_CALLCONV MEM_SIZE  Perl_malloced_size(void *p)
 #endif
 #if defined(MYSWAP)
 PERL_CALLCONV long     Perl_my_htonl(pTHX_ long l)
-                       __attribute__malloc__
                        __attribute__warn_unused_result__
                        __attribute__pure__;
 
 PERL_CALLCONV long     Perl_my_ntohl(pTHX_ long l)
-                       __attribute__malloc__
                        __attribute__warn_unused_result__
                        __attribute__pure__;
 
 PERL_CALLCONV short    Perl_my_swap(pTHX_ short s)
-                       __attribute__malloc__
                        __attribute__warn_unused_result__
                        __attribute__pure__;
 
diff --git a/win32/Makefile b/win32/Makefile
index 7a8f96d..40c6768 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -957,7 +957,7 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL 
..\minimod.pl
 
 $(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
        $(LINK32) -subsystem:console -out:$@ @<<
-       $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ)
+       $(LINK_FLAGS) $(DELAYLOAD) $(LIBFILES) $(MINI_OBJ)
 <<
        $(EMBED_EXE_MANI)
 
diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index 3733c47..d866f76 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -103,8 +103,12 @@ if (exists $opt{cc}) {
 }
 
 $opt{cf_by} = $ENV{USERNAME} unless $opt{cf_by};
-$opt{cf_email} = $opt{cf_by} . '@' . (gethostbyname('localhost'))[0]
-       unless $opt{cf_email};
+if (!$opt{cf_email}) {
+    my $computername = eval{(gethostbyname('localhost'))[0]};
+# gethostbyname might not be implemented in miniperl
+    $computername = $ENV{COMPUTERNAME} if $@;    
+    $opt{cf_email} = $opt{cf_by} . '@' . $computername;
+}
 $opt{usemymalloc} = 'y' if $opt{d_mymalloc} eq 'define';
 
 $opt{libpth} = mungepath($opt{libpth}) if exists $opt{libpth};
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 2905cd6..aa3b880 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1086,7 +1086,7 @@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS)
            $(mktmp $(LKPRE) $(MINI_OBJ) $(LIBFILES) $(LKPOST))
 .ELSE
        $(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) \
-           @$(mktmp $(LIBFILES) $(MINI_OBJ))
+           @$(mktmp $(DELAYLOAD) $(LIBFILES) $(MINI_OBJ))
        $(EMBED_EXE_MANI)
 .ENDIF
 
diff --git a/win32/win32.c b/win32/win32.c
index bfc02fd..5a932ca 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2726,7 +2726,11 @@ win32_freopen(const char *path, const char *mode, FILE 
*stream)
 DllExport int
 win32_fclose(FILE *pf)
 {
+#ifdef WIN32_NO_SOCKETS
+    return fclose(pf);
+#else
     return my_fclose(pf);      /* defined in win32sck.c */
+#endif
 }
 
 DllExport int
@@ -3245,7 +3249,11 @@ extern int my_close(int);        /* in win32sck.c */
 DllExport int
 win32_close(int fd)
 {
+#ifdef WIN32_NO_SOCKETS
+    return close(fd);
+#else
     return my_close(fd);
+#endif
 }
 
 DllExport int
diff --git a/win32/win32.h b/win32/win32.h
index 0474c61..3065867 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -13,6 +13,38 @@
 #  define _WIN32_WINNT 0x0500     /* needed for CreateHardlink() etc. */
 #endif
 
+#ifdef PERL_IS_MINIPERL
+/* this macro will remove Winsock only on miniperl, PERL_IMPLICIT_SYS and
+ * makedef.pl create dependencies that will keep Winsock linked in even with
+ * this macro defined, even though sockets will be umimplemented from a script
+ * level in full perl
+ */
+#  define WIN32_NO_SOCKETS
+#endif
+
+#ifdef WIN32_NO_SOCKETS
+#  undef HAS_SOCKET
+#  undef HAS_GETPROTOBYNAME
+#  undef HAS_GETPROTOBYNUMBER
+#  undef HAS_GETPROTOENT
+#  undef HAS_GETNETBYNAME
+#  undef HAS_GETNETBYADDR
+#  undef HAS_GETNETENT
+#  undef HAS_GETSERVBYNAME
+#  undef HAS_GETSERVBYPORT
+#  undef HAS_GETSERVENT
+#  undef HAS_GETHOSTBYNAME
+#  undef HAS_GETHOSTBYADDR
+#  undef HAS_GETHOSTENT
+#  undef HAS_SELECT
+#  undef HAS_IOCTL
+#  undef HAS_NTOHL
+#  undef HAS_HTONL
+#  undef HAS_HTONS
+#  undef HAS_NTOHS
+#  define WIN32SCK_IS_STDSCK
+#endif
+
 #if defined(PERL_IMPLICIT_SYS)
 #  define DYNAMIC_ENV_FETCH
 #  define HAS_GETENV_LEN
@@ -166,8 +198,10 @@ struct utsname {
 #define  OP_BINARY     O_BINARY        /* mistake in in pp_sys.c? */
 
 /* read() and write() aren't transparent for socket handles */
-#define PERL_SOCK_SYSREAD_IS_RECV
-#define PERL_SOCK_SYSWRITE_IS_SEND
+#ifndef WIN32_NO_SOCKETS
+#  define PERL_SOCK_SYSREAD_IS_RECV
+#  define PERL_SOCK_SYSWRITE_IS_SEND
+#endif
 
 #define PERL_NO_FORCE_LINK             /* no need for PL_force_link_funcs */
 
diff --git a/win32/win32sck.c b/win32/win32sck.c
index 479d99e..9032a6d 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -82,31 +82,50 @@ start_sockets(void)
     wsock_started = 1;
 }
 
+/* in no sockets Win32 builds, this fowards to replacements in util.c, dTHX
+ * is required
+ */
 u_long
 win32_htonl(u_long hostlong)
 {
+#ifdef MYSWAP
+    dTHX;
+#else
     StartSockets();
+#endif
     return htonl(hostlong);
 }
 
 u_short
 win32_htons(u_short hostshort)
 {
+#ifdef MYSWAP
+    dTHX;
+#else
     StartSockets();
+#endif
     return htons(hostshort);
 }
 
 u_long
 win32_ntohl(u_long netlong)
 {
+#ifdef MYSWAP
+    dTHX;
+#else
     StartSockets();
+#endif
     return ntohl(netlong);
 }
 
 u_short
 win32_ntohs(u_short netshort)
 {
+#ifdef MYSWAP
+    dTHX;
+#else
     StartSockets();
+#endif
     return ntohs(netshort);
 }
 

--
Perl5 Master Repository

Reply via email to