New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual C 6 C++ mode syntax errors in Perl_av_extend_guts about goto'ing around a var initialization #13423
Comments
From @bulk88Created by @bulk88When I try to do a C++ build using VC 6 with DEBUGGING and PERL_POISON, del /f config.h C2362 docs for VC 6 now note the docs for C2362 for VC 2003, /Za flag docs for VC 6 I dont have a good idea on how to fix this. Start using /Za (untested) preproced of av_extend_guts (void) ((maxp) || (_assert("maxp", "../av.c", 92), 0)); if (key > *maxp) { if (av && *allocp != *arrayp) { static const char oom_array_extend[] = "Out of memory during if (*allocp) { newmax = key + *maxp / 5; ary = *allocp + *maxp + 1; Perl Info
|
From @bulk88On Thu Nov 14 23:58:34 2013, bulk88 wrote:
Patch attached to fix this. But of course more problems in other files with VC6 with mg_names.c being #include'd into dump.c. Log attached. -- |
From @bulk880001-perl-120544-fix-goto-around-var-init-error-in-av_ext.patchFrom 46fe68bbb249d634fcfcb1ac171ac891fb57940e Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Fri, 15 Nov 2013 03:21:53 -0500
Subject: [PATCH] [perl #120544] fix "goto" around var init error in
av_extend_guts
This fixes a Win32 Visual C 6 in C++ mode syntax error. See #120544 for
the details.
---
av.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/av.c b/av.c
index 2a8ccf0..bae7e61 100644
--- a/av.c
+++ b/av.c
@@ -112,11 +112,6 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
}
}
else {
-#ifdef PERL_MALLOC_WRAP
- static const char oom_array_extend[] =
- "Out of memory during array extend"; /* Duplicated in pp_hot.c */
-#endif
-
if (*allocp) {
#ifdef Perl_safesysmalloc_size
@@ -141,7 +136,13 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
#endif
newmax = key + *maxp / 5;
resize:
- MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+ {
+#ifdef PERL_MALLOC_WRAP /* Duplicated in pp_hot.c */
+ static const char oom_array_extend[] =
+ "Out of memory during array extend";
+#endif
+ MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+ }
Renew(*allocp,newmax+1, SV*);
#ifdef Perl_safesysmalloc_size
resized:
@@ -156,7 +157,13 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
}
else {
newmax = key < 3 ? 3 : key;
- MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+ {
+#ifdef PERL_MALLOC_WRAP /* Duplicated in pp_hot.c */
+ static const char oom_array_extend[] =
+ "Out of memory during array extend";
+#endif
+ MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+ }
Newx(*allocp, newmax+1, SV*);
ary = *allocp + 1;
tmp = newmax;
--
1.7.9.msysgit.0
|
From @bulk88 cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONSOLE -DNO_STRICT -DPERLDLL -DPERL_CORE -Od -MD -Zi -DDEBUGGING -DPERL_POISON -TP -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\dump.obj ..\dump.c |
From @bulk88On Fri Nov 15 00:28:08 2013, bulk88 wrote:
errored out declaration that VC 6 in C++ mode didnt like static const struct { { -- |
From perl5-porters@perl.orgDaniel Dragan wrote:
Thank you. Applied as 1ca67c8. |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Thu Nov 14 23:58:34 2013, bulk88 wrote:
This doesn't match the code I'm seeing in av.c (blead) - it looks like the block The code in av.c that I see: { matches the case in the VS6 documentation that it says it acceptable: void func() So I'm not sure what's going on. Did you make some local modifications to try and prevent the error? Tony |
From @bulk88On Sun Nov 17 17:08:12 2013, tonyc wrote:
No, blead got a patch https://rt-archive.perl.org/perl5/Ticket/Display.html?id=120544#txn-1268416 already for the 1st post of this ticket, after I figured out the path of least resistance to fixing it. Read the rest of the posts in the ticket for the mg_names.c/dump.c problem. -- |
From @tonycozOn Sun Nov 17 17:37:26 2013, bulk88 wrote:
Thanks, I missed that. For me, changing: static const struct { const char type; const char *name; } magic_names[] = { to static const struct { char type; const char *name; } magic_names[] = { fixes the build for VC6, does that do it for you? That const is extraneous considering the entire array is const, and name isn't Tony |
From @bulk88On Sun Nov 17 18:48:59 2013, tonyc wrote:
That makes dump.c compile fine on my VC6. You commit it since you test on more platforms than me. Next issue, /* (PL_op->op_pmflags & PMf_split ) We could add a new mask for this and copy the PMf_split, if we did For now we leave this new_re = (eng->op_comp if (pm->op_pmflags & PMf_HAS_CV) if (is_bare_re) { new_re = extern "C" REGEXP * Perl_re_op_compile(PerlInterpreter * my_perl, SV ** const patternp, REGEXP *(*op_comp) (PerlInterpreter * my_perl, SV ** const patternp, int pat_count, In Perl_re_op_compile eng var is a different literal type but I think the compiler would consider them identical. In the message its seems to be complaining one function * is const, the other is RW. "const regexp_engine *eng;" is declared as const, so the struct is const but not the refering *. Not sure what to do, other than a large function pointer cast. I tried regexp.h | 2 +- Inline Patchdiff --git a/regexp.h b/regexp.h
index 928a374..94638d6 100644
--- a/regexp.h
+++ b/regexp.h
@@ -181,7 +181,7 @@ typedef struct regexp_engine {
#ifdef USE_ITHREADS
void* (*dupe) (pTHX_ REGEXP * const rx, CLONE_PARAMS *param);
#endif
- REGEXP* (*op_comp) (pTHX_ SV ** const patternp, int pat_count,
+ REGEXP* (* const op_comp) (pTHX_ SV ** const patternp, int pat_count,
OP *expr, const struct regexp_engine* eng,
REGEXP *VOL old_re,
bool *is_bare_re, U32 orig_rx_flags, U32 pm_flags);
--------------------------------------
cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS -- |
From @tonycozOn Sun Nov 17 20:51:40 2013, bulk88 wrote:
I suspect it's the volatime on th the p5rx parameter. Which the compiler shouldn't consider part of the function type. Tony |
We no longer support Visual C++ 6, see 7adf247. |
Migrated from rt.perl.org#120544 (status was 'open')
Searchable as RT120544$
The text was updated successfully, but these errors were encountered: