develooper Front page | perl.perl5.porters | Postings from January 2008

compile warnings w/ PM_SETRE and ReREFCNT_inc

Thread Next
From:
Craig A. Berry
Date:
January 6, 2008 16:14
Subject:
compile warnings w/ PM_SETRE and ReREFCNT_inc
Message ID:
p06240804c3a6eaa69b59@[172.16.52.1]
With blead@32879, the following warnings cause the build to die early on VMS:

        PM_SETRE(pm,ReREFCNT_inc(rx));
........^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the 
pointer value "(((PL_Sv=(SV ...)(rx))?(++((PL_Sv)->sv_refcnt),PL_Sv
):((void ...)0)))" is "struct sv", which is not compatible with "struct p5rx".
at line number 215 in file D0:[CRAIG.perl]pp_ctl.c;1

     PM_SETRE(matcher, ReREFCNT_inc(re));
....^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the 
pointer value "(((PL_Sv=(SV ...)(re))?(++((PL_Sv)->sv_refcnt),PL_Sv
):((void ...)0)))" is "struct sv", which is not compatible with "struct p5rx".
at line number 3852 in file D0:[CRAIG.perl]pp_ctl.c;1

After change #32804, the definition of ReREFCNT_inc for the non-gcc
case is merely the following:

#  define ReREFCNT_inc(re)	SvREFCNT_inc(re)

My first thought was something like

#  define ReREFCNT_inc(re)	(REGEXP*)SvREFCNT_inc(re)

was needed, but that causes trouble when the increment is used in
void context.  On the other hand, the following does shut up the
compiler but seems too big a hammer, basically wiping out all type
checking for PM_SETRE:

--- op.h;-0     Sun Jan  6 09:24:39 2008
+++ op.h        Sun Jan  6 13:49:48 2008
@@ -351,7 +351,7 @@ struct pmop {
  #  endif
  #else
  #define PM_GETRE(o)     ((o)->op_pmregexp)
-#define PM_SETRE(o,r)   ((o)->op_pmregexp = (r))
+#define PM_SETRE(o,r)   ((o)->op_pmregexp = (REGEXP*)(r))
  #  ifndef PERL_CORE
  #define PM_GETRE_SAFE PM_GETRE
  #define PM_SETRE_SAFE PM_SETRE
[end]

It seems to me ReREFCNT_inc should be responsible for returning a
pointer to REGEXP, but I'm probably not the best person to suggest
how to make it do that.
-- 
________________________________________
Craig A. Berry
mailto:craigberry@mac.com

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser

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