develooper Front page | perl.ponie.dev | Postings from July 2005

Re: Ponie development snapshot 4

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
July 11, 2005 11:27
Subject:
Re: Ponie development snapshot 4
Message ID:
20050711182727.GJ15833@plum.flirble.org
On Mon, Jul 11, 2005 at 11:57:22AM +0100, Nicholas Clark wrote:

> gcc agreed when it was forced to try to compile that bit.
> Could you try the following, which gcc is happy with:

I think you'll then hit a problem in regexec.c, something like this:


regcomp.c: In function `Perl_pregfree':
regcomp.c:6127: error: syntax error before "do"
regcomp.c:6127: error: syntax error before '.' token
regcomp.c:6127: warning: unused variable `dsv'

I'm not sure how to solve this one. The problem is the macro

#define PERL_DEBUG_PAD_ZERO(i)	(SvPVX(PERL_DEBUG_PAD(i))[0] = 0, SvCUR_set(PERL_DEBUG_PAD(i), 0), PERL_DEBUG_PAD(i))

In turn, SvCUR_set() is

#define SvCUR_set(sv, val) \
	STMT_START { assert(SvTYPE(sv) >= SVt_PV); \
		(*(STRLEN *)Parrot_PMC_get_pointer_intkey(PL_Parrot,MUMBLE(sv), Ponie_P_CUR) = (val)); } STMT_END


STMT_START is one of

#  if (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
#   define STMT_START	if (1)
#   define STMT_END	else (void)0
#  else
#   define STMT_START	do
#   define STMT_END	while (0)
#  endif

so the compiler is choking on the expansion

, do {


The simple solution would seem to be to change PERL_DEBUG_PAD_ZERO to be
STMT_START ... STMT_END and not return PERL_DEBUG_PAD(i) as the last thing.
It's just that quite a lot of code expects that return value, and was hoping
for a nice piece of C syntax to avoid needing to re-write it:

$ grep -C3 DEBUG_PAD_ZERO *.c
regcomp.c-{
regcomp.c-#ifdef DEBUGGING
regcomp.c-    /* FIXME May go boom if someone runs with -Dr  */
regcomp.c:    SV *dsv = PERL_DEBUG_PAD(0) ? PERL_DEBUG_PAD_ZERO(0) : Nullsv;
regcomp.c-    SV *re_debug_flags=get_sv(RE_DEBUG_FLAGS,0);
regcomp.c-#endif
regcomp.c-
--
regexec.c-    I32 multiline = prog->reganch & PMf_MULTILINE;
regexec.c-#ifdef DEBUGGING
regexec.c-    char *i_strpos = strpos;
regexec.c:    SV *dsv = PERL_DEBUG_PAD_ZERO(0);
regexec.c-#endif
regexec.c-
regexec.c-    GET_RE_DEBUG_FLAGS_DECL;
--
regexec.c-    bool do_utf8 = DO_UTF8(sv);
regexec.c-    I32 multiline = prog->reganch & PMf_MULTILINE;
regexec.c-#ifdef DEBUGGING
regexec.c:    SV *dsv0 = PERL_DEBUG_PAD_ZERO(0);
regexec.c:    SV *dsv1 = PERL_DEBUG_PAD_ZERO(1);
regexec.c-#endif
regexec.c-
regexec.c-    GET_RE_DEBUG_FLAGS_DECL;
--
regexec.c-#endif
regexec.c-    register bool do_utf8 = PL_reg_match_utf8;
regexec.c-#ifdef DEBUGGING
regexec.c:    SV *dsv0 = PERL_DEBUG_PAD_ZERO(0);
regexec.c:    SV *dsv1 = PERL_DEBUG_PAD_ZERO(1);
regexec.c:    SV *dsv2 = PERL_DEBUG_PAD_ZERO(2);
regexec.c-
regexec.c-    SV *re_debug_flags;
regexec.c-#endif


Nicholas Clark

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