This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove __attribute__malloc__ from MYSWAP functions
authorSteve Hay <steve.m.hay@googlemail.com>
Thu, 1 Nov 2012 13:43:39 +0000 (13:43 +0000)
committerSteve Hay <steve.m.hay@googlemail.com>
Thu, 1 Nov 2012 13:43:39 +0000 (13:43 +0000)
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).

embed.fnc
proto.h

index 9fab558..3068905 100644 (file)
--- 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)
 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
 #endif
 : Used in pp_ctl.c
 p      |void   |my_unexec
diff --git a/proto.h b/proto.h
index d069792..4bfa724 100644 (file)
--- 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)
 #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__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__warn_unused_result__
                        __attribute__pure__;
 
 PERL_CALLCONV short    Perl_my_swap(pTHX_ short s)
-                       __attribute__malloc__
                        __attribute__warn_unused_result__
                        __attribute__pure__;
 
                        __attribute__warn_unused_result__
                        __attribute__pure__;