develooper Front page | perl.perl5.porters | Postings from September 2001

Re: macro redefinitions on Win32 (was Re: Question about PERLIO)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
September 28, 2001 15:39
Subject:
Re: macro redefinitions on Win32 (was Re: Question about PERLIO)
Message ID:
20010928233933.C23673@plum.flirble.org
On Fri, Sep 28, 2001 at 09:30:55PM +0300, Jarkko Hietaniemi wrote:
> On Fri, Sep 28, 2001 at 07:28:18PM +0100, Nicholas Clark wrote:
> > On Wed, Sep 26, 2001 at 02:12:10AM +0200, Abe Timmerman wrote:
> > > BTW: I still get lots of these:
> > > 
> > > ..\embed.h(2161) : warning C4005: 'sv_2pv' : macro redefinition
> > >         ..\sv.h(993) : see previous definition of 'sv_2pv'
> > > ..\embed.h(2178) : warning C4005: 'sv_catpvn' : macro redefinition
> > >         ..\sv.h(991) : see previous definition of 'sv_catpvn'
> > > ..\embed.h(2179) : warning C4005: 'sv_catsv' : macro redefinition
> > >         ..\sv.h(989) : see previous definition of 'sv_catsv'
> > > ..\embed.h(2212) : warning C4005: 'sv_pvn_force' : macro redefinition
> > >         ..\sv.h(995) : see previous definition of 'sv_pvn_force'
> > > ..\embed.h(2231) : warning C4005: 'sv_setsv' : macro redefinition
> > >         ..\sv.h(987) : see previous definition of 'sv_setsv'
> > > ..\embed.h(2345) : warning C4005: 'sv_utf8_upgrade' : macro redefinition
> > >         ..\sv.h(997) : see previous definition of 'sv_utf8_upgrade'
> > 
> > The errors relate to "redefinition" where one definition is inside an
> > #ifdef CRIPPLED_CC
> > block and the other definition is inside an
> > #ifndef CRIPPLED_CC
> > block?
> > 
> > If so, does anyone have any idea why it seems that (some) Windows compilers
> > and Tru64(?) don't like this?
> 
> Could you give a pointer to the latest patch supposed to fix this?
> I could retry it in Tru64, maybe I was seeing gremlins.

This was hoped to fix it. Need to rerun embed.pl to make a new embed.h

Nicholas Clark

--- embed.pl.orig	Mon Sep 10 12:06:16 2001
+++ embed.pl	Wed Sep 12 23:05:40 2001
@@ -344,12 +344,14 @@
     else {
 	my ($flags,$retval,$func,@args) = @_;
 	unless ($flags =~ /o/) {
+            $ret .= "#ifdef CRIPPLED_CC\n" if $flags =~ /C/;
 	    if ($flags =~ /s/) {
 		$ret .= hide($func,"S_$func");
 	    }
 	    elsif ($flags =~ /p/) {
 		$ret .= hide($func,"Perl_$func");
 	    }
+            $ret .= "#endif\n" if $flags =~ /C/;
 	}
     }
     $ret;
@@ -1052,6 +1054,7 @@
 :
 : flags are single letters with following meanings:
 :	A		member of public API
+:	C		wrap compatibility macro in #ifdef DCRIPPLED_CC
 :	d		function has documentation with its source
 :	s		static function, should have an S_ prefix in source
 :				file
@@ -1720,10 +1723,10 @@
 Apd	|IV	|sv_2iv		|SV* sv
 Apd	|SV*	|sv_2mortal	|SV* sv
 Apd	|NV	|sv_2nv		|SV* sv
-Ap	|char*	|sv_2pv		|SV* sv|STRLEN* lp
+ACp	|char*	|sv_2pv		|SV* sv|STRLEN* lp
 Apd	|char*	|sv_2pvutf8	|SV* sv|STRLEN* lp
 Apd	|char*	|sv_2pvbyte	|SV* sv|STRLEN* lp
-Ap	|char*	|sv_pvn_nomg	|SV* sv|STRLEN* lp
+ACp	|char*	|sv_pvn_nomg	|SV* sv|STRLEN* lp
 Apd	|UV	|sv_2uv		|SV* sv
 Apd	|IV	|sv_iv		|SV* sv
 Apd	|UV	|sv_uv		|SV* sv
@@ -1738,8 +1741,8 @@
 Afpd	|void	|sv_catpvf	|SV* sv|const char* pat|...
 Ap	|void	|sv_vcatpvf	|SV* sv|const char* pat|va_list* args
 Apd	|void	|sv_catpv	|SV* sv|const char* ptr
-Apd	|void	|sv_catpvn	|SV* sv|const char* ptr|STRLEN len
-Apd	|void	|sv_catsv	|SV* dsv|SV* ssv
+ACpd	|void	|sv_catpvn	|SV* sv|const char* ptr|STRLEN len
+ACpd	|void	|sv_catsv	|SV* dsv|SV* ssv
 Apd	|void	|sv_chop	|SV* sv|char* ptr
 pd	|I32	|sv_clean_all
 pd	|void	|sv_clean_objs
@@ -1774,7 +1777,7 @@
 Ap	|char*	|sv_peek	|SV* sv
 Apd	|void	|sv_pos_u2b	|SV* sv|I32* offsetp|I32* lenp
 Apd	|void	|sv_pos_b2u	|SV* sv|I32* offsetp
-Apd	|char*	|sv_pvn_force	|SV* sv|STRLEN* lp
+ACpd	|char*	|sv_pvn_force	|SV* sv|STRLEN* lp
 Apd	|char*	|sv_pvutf8n_force|SV* sv|STRLEN* lp
 Apd	|char*	|sv_pvbyten_force|SV* sv|STRLEN* lp
 Apd	|char*	|sv_reftype	|SV* sv|int ob
@@ -1795,7 +1798,7 @@
 				|STRLEN n
 Apd	|void	|sv_setpv	|SV* sv|const char* ptr
 Apd	|void	|sv_setpvn	|SV* sv|const char* ptr|STRLEN len
-Apd	|void	|sv_setsv	|SV* dsv|SV* ssv
+ACpd	|void	|sv_setsv	|SV* dsv|SV* ssv
 Apd	|void	|sv_taint	|SV* sv
 Apd	|bool	|sv_tainted	|SV* sv
 Apd	|int	|sv_unmagic	|SV* sv|int type
@@ -1926,7 +1929,7 @@
 Apd	|char*	|sv_pv		|SV *sv
 Apd	|char*	|sv_pvutf8	|SV *sv
 Apd	|char*	|sv_pvbyte	|SV *sv
-Apd	|STRLEN	|sv_utf8_upgrade|SV *sv
+ACpd	|STRLEN	|sv_utf8_upgrade|SV *sv
 ApdM	|bool	|sv_utf8_downgrade|SV *sv|bool fail_ok
 Apd	|void	|sv_utf8_encode |SV *sv
 ApdM	|bool	|sv_utf8_decode |SV *sv
--- sv.h.orig	Thu Sep  6 00:40:50 2001
+++ sv.h	Wed Sep 12 23:02:17 2001
@@ -983,17 +983,11 @@
 #define sv_utf8_upgrade_macro(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)
 
 /* function style also available for sourcecompat */
-#undef sv_setsv
 #define sv_setsv(dsv, ssv) sv_setsv_macro(dsv, ssv)
-#undef sv_catsv
 #define sv_catsv(dsv, ssv) sv_catsv_macro(dsv, ssv)
-#undef sv_catpvn
 #define sv_catpvn(dsv, sstr, slen) sv_catpvn_macro(dsv, sstr, slen)
-#undef sv_2pv
 #define sv_2pv(sv, lp) sv_2pv_macro(sv, lp)
-#undef sv_pvn_force
 #define sv_pvn_force(sv, lp) sv_pvn_force_macro(sv, lp)
-#undef sv_utf8_upgrade
 #define sv_utf8_upgrade(sv) sv_utf8_upgrade_macro(sv)
 
 #undef SvPV

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About