Skip to content
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

Closed
p5pRT opened this issue Nov 15, 2013 · 13 comments
Labels

Comments

@p5pRT
Copy link

p5pRT commented Nov 15, 2013

Migrated from rt.perl.org#120544 (status was 'open')

Searchable as RT120544$

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From @bulk88

Created by @bulk88

When I try to do a C++ build using VC 6 with DEBUGGING and PERL_POISON,
I get
------------------------------------------------------
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

  del /f config.h
Could Not Find C​:\perl519\src\win32\config.h
  copy config_H.vc config.h
  1 file(s) copied.
  if not exist ".\mini" mkdir ".\mini"
  cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32
-D_CONS
OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -Od -MD -Zi -DDEBUGGING
-DPERL_POISON -T
P -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\av.obj ..\av.c
av.c
..\inline.h(264) : warning C4244​: '=' : conversion from 'long' to
'unsigned char
', possible loss of data
..\av.c(143) : error C2362​: initialization of 'oom_array_extend' is
skipped by '
goto resize'
  ..\av.c(116) : see declaration of 'oom_array_extend'
NMAKE : fatal error U1077​: 'cl' : return code '0x2'
Stop.
------------------------------------------------------
This doesn't happen on VC 2003.

C2362 docs for VC 6
http​://msdn.microsoft.com/en-us/library/aa241948%28v=vs.60%29.aspx

now note the docs for C2362 for VC 2003,
http​://msdn.microsoft.com/en-us/library/vstudio/s6s80d9f%28v=vs.71%29.aspx
it mentions a /Za strict ANSI flag, this wasn't in the VC 6 page for C2362

/Za flag docs for VC 6
http​://msdn.microsoft.com/en-us/library/aa278577%28v=vs.60%29.aspx
/Za flag docs for VC 2003
http​://msdn.microsoft.com/en-us/library/vstudio/0k0w269d%28v=vs.71%29.aspx

I dont have a good idea on how to fix this. Start using /Za (untested)
on VC6 from the makefiles? Move oom_array_extend const string to file
level scope instead of block level scope? Do nothing because VC 6 is old
and C++ mode is nonstandard for Perl core anyways, and once this is
knocked down 100 more syntax/build errors will come up? Any other ideas?

preproced of av_extend_guts
--------------------------------------------------------
  cl -c -I.. -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I..
-DWIN32 -D
_CONSOLE -DNO_STRICT -DPERLDLL -DPERL_CORE -Od -MD -Zi -DDEBUGGING
-DPERL_POIS
ON -TP -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUS
E_PERLIO -D_USE_32BIT_TIME_T -P -Fo../av.i ../av.c
--------------------------------------------------------
void
Perl_av_extend_guts(PerlInterpreter * my_perl, AV * av, int key, int
*maxp, SV *** allocp, SV *** arrayp)
{
  (void) 0;

  (void) ((maxp) || (_assert("maxp", "../av.c", 92), 0));
  (void) ((allocp) || (_assert("allocp", "../av.c", 92), 0));
  (void) ((arrayp) || (_assert("arrayp", "../av.c", 92), 0));

  if (key > *maxp) {
  SV **ary;
  int tmp;
  int newmax;

  if (av && *allocp != *arrayp) {
  ary = *allocp + ((XPVAV *) (av)->sv_any)->xav_fill + 1;
  tmp = *arrayp - *allocp;
  ((void)
  (sizeof(SV *) > 1
  && ((size_t) (((XPVAV *) (av)->sv_any)->xav_fill + 1) +
0.0) > ((size_t) ~ 0) / sizeof(SV *)
  && (S_croak_memory_wrap(), 0)), (void) memmove((char *)
(*allocp), (const char *) (*arrayp),
  (((XPVAV *)
(av)->sv_any)->xav_fill +
  1) *
sizeof(SV *)));
  *maxp += tmp;
  *arrayp = *allocp;
  if (((av)->sv_flags & 0x40000000)) {
  while (tmp)
  ary[--tmp] = 0;
  }
  if (key > *maxp - 10) {
  newmax = key + *maxp;
  goto resize;
  }
  } else {

  static const char oom_array_extend[] = "Out of memory during
array extend";
#line 119 "../av.c"

  if (*allocp) {

  newmax = key + *maxp / 5;
  resize​:
  (void) (sizeof(SV *) > 1 && ((size_t) (newmax + 1) +
0.0) > ((size_t) ~ 0) / sizeof(SV *)
  && (Perl_croak_nocontext("%s",
(oom_array_extend)), 0));
  (*allocp =
  ((void)
  (sizeof(SV *) > 1 && ((size_t) (newmax + 1) + 0.0) >
((size_t) ~ 0) / sizeof(SV *)
  && (S_croak_memory_wrap(), 0)), (SV **)
(Perl_safesysrealloc((void *) (*allocp),
 
(size_t) ((newmax +
 
1) *
 
sizeof(SV *))))));

  ary = *allocp + *maxp + 1;
  tmp = newmax - *maxp;
  if (av == (my_perl->Icurstack)) {
  (my_perl->Istack_sp) = *allocp +
((my_perl->Istack_sp) - (my_perl->Istack_base));
  (my_perl->Istack_base) = *allocp;
  (my_perl->Istack_max) = (my_perl->Istack_base) + newmax;
  }
  } else {
-------------------------------------

Perl Info

Flags:
    category=core
    severity=low

This perlbug was built using Perl 5.19.6 - Thu Oct 24 19:59:31 2013
It is being executed now by  Perl 5.19.6 - Thu Nov 14 20:10:57 2013.

Site configuration information for perl 5.19.6:

Configured by Owner at Thu Nov 14 20:10:57 2013.

Summary of my perl5 (revision 5 version 19 subversion 6) configuration:
  Derived from: d93134d6480d10a1ade72c381efa9645814655cf
  Ancestor: ae103e099635e075f433d5302425673c4fe7badf
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING 
-DPERL_POISON -DWIN32 -D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO 
-D_USE_32BIT_TIME_T',
    optimize='-Od -MD -Zi -DDEBUGGING -DPERL_POISON',
    cppflags='-DWIN32'
    ccversion='12.00.8168', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug  
-libpath:"c:\perl519\nnsv\lib\CORE"  -machine:x86'
    libpth=C:\PROGRA~1\MIAF9D~1\VC98\lib
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  
version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl519.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug  
-libpath:"c:\perl519\nnsv\lib\CORE"  -machine:x86'

Locally applied patches:
    uncommitted-changes
    721000cb2bcbd3292ef9171f35acf43985eeea15
    d93134d6480d10a1ade72c381efa9645814655cf


@INC for perl 5.19.6:
    C:/perl519/src/lib
    .


Environment for perl 5.19.6:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\perl519\bin;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 
2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
    PERL_BADLANG (unset)
    SHELL (unset)



@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From @bulk88

On Thu Nov 14 23​:58​:34 2013, bulk88 wrote​:

This is a bug report for perl from bulk88@​hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.19.6.

-----------------------------------------------------------------
[Please describe your issue here]

When I try to do a C++ build using VC 6 with DEBUGGING and
PERL_POISON,

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.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From @bulk88

0001-perl-120544-fix-goto-around-var-init-error-in-av_ext.patch
From 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

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

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
dump.c
..\inline.h(264) : warning C4244​: '=' : conversion from 'long' to 'unsigned char', possible loss of data
..\mg_names.c(9) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(9) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(10) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(10) : error C2440​: 'initializing' : cannot convert from 'char [10]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(11) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(11) : error C2440​: 'initializing' : cannot convert from 'char [9]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(12) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(12) : error C2440​: 'initializing' : cannot convert from 'char [9]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(13) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(13) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(14) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(14) : error C2440​: 'initializing' : cannot convert from 'char [10]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(15) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(15) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(16) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(16) : error C2440​: 'initializing' : cannot convert from 'char [12]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(17) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(17) : error C2440​: 'initializing' : cannot convert from 'char [6]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(18) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(18) : error C2440​: 'initializing' : cannot convert from 'char [18]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(19) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(19) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(20) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(20) : error C2440​: 'initializing' : cannot convert from 'char [12]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(21) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(21) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(22) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(22) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(23) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(23) : error C2440​: 'initializing' : cannot convert from 'char [6]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(24) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(24) : error C2440​: 'initializing' : cannot convert from 'char [16]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(25) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(25) : error C2440​: 'initializing' : cannot convert from 'char [9]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(26) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(26) : error C2440​: 'initializing' : cannot convert from 'char [13]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(27) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(27) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(28) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(28) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(29) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(29) : error C2440​: 'initializing' : cannot convert from 'char [9]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(30) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(30) : error C2440​: 'initializing' : cannot convert from 'char [10]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(31) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(31) : error C2440​: 'initializing' : cannot convert from 'char [10]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(32) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(32) : error C2440​: 'initializing' : cannot convert from 'char [10]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(33) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(33) : error C2440​: 'initializing' : cannot convert from 'char [17]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(34) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(34) : error C2440​: 'initializing' : cannot convert from 'char [12]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(35) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(35) : error C2440​: 'initializing' : cannot convert from 'char [8]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(36) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(36) : error C2440​: 'initializing' : cannot convert from 'char [12]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(37) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(37) : error C2440​: 'initializing' : cannot convert from 'char [14]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(38) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(38) : error C2440​: 'initializing' : cannot convert from 'char [6]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(39) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(39) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(40) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(40) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(41) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(41) : error C2440​: 'initializing' : cannot convert from 'char [9]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(42) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(42) : error C2440​: 'initializing' : cannot convert from 'char [8]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(43) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(43) : error C2440​: 'initializing' : cannot convert from 'char [13]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(44) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(44) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(45) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(45) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(46) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(46) : error C2440​: 'initializing' : cannot convert from 'char [8]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(47) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(47) : error C2440​: 'initializing' : cannot convert from 'char [10]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(48) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(48) : error C2440​: 'initializing' : cannot convert from 'char [11]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(49) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(49) : error C2440​: 'initializing' : cannot convert from 'char [13]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(50) : error C2440​: 'initializing' : cannot convert from 'const char' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\mg_names.c(50) : error C2440​: 'initializing' : cannot convert from 'char [7]' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\dump.c(1209) : error C2440​: 'initializing' : cannot convert from 'const int' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous
..\dump.c(1209) : error C2440​: 'initializing' : cannot convert from 'const int' to 'const struct '
  No constructor could take the source type, or constructor overload resolution was ambiguous

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From @bulk88

On Fri Nov 15 00​:28​:08 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.

errored out declaration that VC 6 in C++ mode didnt like


static const struct {
  const char type;
  const char *name;
} magic_names[] = {
#line 1 "..\\mg_names.c"

  {
  '\0', "sv(\\0)"}, {
  '#', "arylen(#)"}, {
  '%', "rhash(%)"}, {
  '&', "proto(&)"}, {
  '.', "pos(.)"}, {
  '​:', "symtab(​:)"}, {
  '<', "backref(<)"}, {
  '@​', "arylen_p(@​)"}, {
  'B', "bm(B)"}, {
  'c', "overload_table(c)"}, {
  'D', "regdata(D)"}, {
  'd', "regdatum(d)"}, {
  'E', "env(E)"}, {
  'e', "envelem(e)"}, {
  'f', "fm(f)"}, {
  'g', "regex_global(g)"}, {
  'H', "hints(H)"}, {
  'h', "hintselem(h)"}, {
  'I', "isa(I)"}, {
  'i', "isaelem(i)"}, {
  'k', "nkeys(k)"}, {
  'L', "dbfile(L)"}, {
  'l', "dbline(l)"}, {
  'N', "shared(N)"}, {
  'n', "shared_scalar(n)"}, {
  'o', "collxfrm(o)"}, {
  'P', "tied(P)"}, {
  'p', "tiedelem(p)"}, {
  'q', "tiedscalar(q)"}, {
  'r', "qr(r)"}, {
  'S', "sig(S)"}, {
  's', "sigelem(s)"}, {
  't', "taint(t)"}, {
  'U', "uvar(U)"}, {
  'u', "uvar_elem(u)"}, {
  'V', "vstring(V)"}, {
  'v', "vec(v)"}, {
  'w', "utf8(w)"}, {
  'x', "substr(x)"}, {
  'y', "defelem(y)"}, {
  ']', "checkcall(])"}, {
  '', "ext()"},
#line 1208 "..\\dump.c"
  {
0, 0},};


--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From perl5-porters@perl.org

Daniel Dragan wrote​:

When I try to do a C++ build using VC 6 with DEBUGGING and
PERL_POISON,

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.

Thank you. Applied as 1ca67c8.

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From @tonycoz

On Thu Nov 14 23​:58​:34 2013, bulk88 wrote​:

This is a bug report for perl from bulk88@​hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.19.6.

-----------------------------------------------------------------
[Please describe your issue here]

When I try to do a C++ build using VC 6 with DEBUGGING and
PERL_POISON,
I get
...
av.c
..\inline.h(264) : warning C4244​: '=' : conversion from 'long' to
'unsigned char
', possible loss of data
..\av.c(143) : error C2362​: initialization of 'oom_array_extend' is
skipped by '
goto resize'
..\av.c(116) : see declaration of 'oom_array_extend'
...

static const char oom_array_extend[] = "Out of memory during
array extend";
#line 119 "../av.c"

if (*allocp) {

newmax = key + *maxp / 5;
resize​:
(void) (sizeof(SV *) > 1 && ((size_t) (newmax + 1) +
0.0) > ((size_t) ~ 0) / sizeof(SV *)
&& (Perl_croak_nocontext("%s",
(oom_array_extend)), 0));
(*allocp =
((void)
(sizeof(SV *) > 1 && ((size_t) (newmax + 1) + 0.0) >
((size_t) ~ 0) / sizeof(SV *)
&& (S_croak_memory_wrap(), 0)), (SV **)
(Perl_safesysrealloc((void *) (*allocp),

(size_t) ((newmax +

1) *

sizeof(SV *))))));

This doesn't match the code I'm seeing in av.c (blead) - it looks like the block
surrounding the definition of oom_array_extend has been removed and the initialization
moved up a few lines.

The code in av.c that I see​:

  {
#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);
  }

matches the case in the VS6 documentation that it says it acceptable​:

void func()
{
  goto label1;
  int i = 1; // error, initialization skipped
  {
  int j = 1; // OK, this block is never entered
  }
label1​:;
}

So I'm not sure what's going on.

Did you make some local modifications to try and prevent the error?

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From @bulk88

On Sun Nov 17 17​:08​:12 2013, tonyc wrote​:

On Thu Nov 14 23​:58​:34 2013, bulk88 wrote​:

This is a bug report for perl from bulk88@​hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.19.6.

-----------------------------------------------------------------
[Please describe your issue here]

When I try to do a C++ build using VC 6 with DEBUGGING and
PERL_POISON,
I get
...
av.c
..\inline.h(264) : warning C4244​: '=' : conversion from 'long' to
'unsigned char
', possible loss of data
..\av.c(143) : error C2362​: initialization of 'oom_array_extend' is
skipped by '
goto resize'
..\av.c(116) : see declaration of 'oom_array_extend'
...

static const char oom_array_extend[] = "Out of memory during
array extend";
#line 119 "../av.c"

if (*allocp) {

newmax = key + *maxp / 5;
resize​:
(void) (sizeof(SV *) > 1 && ((size_t) (newmax + 1) +
0.0) > ((size_t) ~ 0) / sizeof(SV *)
&& (Perl_croak_nocontext("%s",
(oom_array_extend)), 0));
(*allocp =
((void)
(sizeof(SV *) > 1 && ((size_t) (newmax + 1) + 0.0) >
((size_t) ~ 0) / sizeof(SV *)
&& (S_croak_memory_wrap(), 0)), (SV **)
(Perl_safesysrealloc((void *) (*allocp),

(size_t) ((newmax +

1) *

sizeof(SV *))))));

This doesn't match the code I'm seeing in av.c (blead) - it looks like
the block
surrounding the definition of oom_array_extend has been removed and
the initialization
moved up a few lines.

The code in av.c that I see​:

{
#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);
}

matches the case in the VS6 documentation that it says it acceptable​:

void func()
{
goto label1;
int i = 1; // error, initialization skipped
{
int j = 1; // OK, this block is never entered
}
label1​:;
}

So I'm not sure what's going on.

Did you make some local modifications to try and prevent the error?

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.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From @tonycoz

On Sun Nov 17 17​:37​:26 2013, bulk88 wrote​:

On Sun Nov 17 17​:08​:12 2013, tonyc wrote​:

So I'm not sure what's going on.

Did you make some local modifications to try and prevent the error?

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.

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
const.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From @bulk88

On Sun Nov 17 18​:48​:59 2013, tonyc wrote​:

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
const.

Tony

That makes dump.c compile fine on my VC6. You commit it since you test on more platforms than me.

Next issue,
  cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS
OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -Od -MD -Zi -DDEBUGGING -TP -DPERL_EXTER
NAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\pp_ctl.obj ..\pp_ctl.c
pp_ctl.c
..\inline.h(264) : warning C4244​: '=' : conversion from 'long' to 'unsigned char
', possible loss of data
..\pp_ctl.c(125) : error C2446​: '​:' : no conversion from 'struct p5rx *(__cdecl
*)(struct sv **const ,int,struct op *,const struct regexp_engine *,struct p5rx
*,char *,unsigned long,unsigned long)' to 'struct p5rx *(__cdecl *const )(struct
sv **const ,int,struct op *,const struct regexp_engine *,struct p5rx *volatile
,char *,unsigned long,unsigned long)'
  This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
..\pp_ctl.c(129) : error C2064​: term does not evaluate to a function
NMAKE : fatal error U1077​: 'cl' : return code '0x2'



  /*
  In the below logic​: these are basically the same - check if this regcomp is part of a split.

  (PL_op->op_pmflags & PMf_split )
  (PL_op->op_next->op_type == OP_PUSHRE)

  We could add a new mask for this and copy the PMf_split, if we did
  some bit definition fiddling first.

  For now we leave this
  */

  new_re = (eng->op_comp
  ? eng->op_comp
  : &Perl_re_op_compile
  )(aTHX_ args, nargs, pm->op_code_list, eng, re, <<<<<<<<<<<<<<< line 125
  &is_bare_re,
  (pm->op_pmflags & RXf_PMf_FLAGCOPYMASK),
  pm->op_pmflags |
  (PL_op->op_flags & OPf_SPECIAL ? PMf_USE_RE_EVAL : 0));

  if (pm->op_pmflags & PMf_HAS_CV)
  ReANY(new_re)->qr_anoncv
  = (CV*) SvREFCNT_inc(PAD_SV(PL_op->op_targ));

  if (is_bare_re) {
  REGEXP *tmp;


  new_re =
  (eng->op_comp ? eng->op_comp : &Perl_re_op_compile) (my_perl, args, nargs, pm->op_code_list, eng,
  re, &is_bare_re,
  (pm->
  op_pmflags & ((1 << (0 + 0)) | (1 << (0 + 1))
  | (1 << (0 + 2)) | (1 <<
  (0 +
  3)) | (1 <<
  (0 +
  4))
  | (7 << (((0) + 5))) | (1 <<
  (0 +
  8)))),
  pm->op_pmflags | ((my_perl->Iop)->
  op_flags & 128 ? (1 <<
  (((0 + 9) +
  6) +
  13)) :
  0));


  extern "C" REGEXP * Perl_re_op_compile(PerlInterpreter * my_perl, SV ** const patternp,
  int pat_count, OP * expr,
  const regexp_engine * eng, REGEXP * old_re,
  char *is_bare_re, U32 rx_flags, U32 pm_flags);


  REGEXP *(*op_comp) (PerlInterpreter * my_perl, SV ** const patternp, int pat_count,
  OP * expr, const struct regexp_engine * eng, REGEXP * volatile old_re,
  char *is_bare_re, U32 orig_rx_flags, U32 pm_flags);
  } regexp_engine;


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 +-
1 files changed, 1 insertions(+), 1 deletions(-)


Inline Patch
diff --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);
--------------------------------------
but it resulted in what I think (eye scan only) is no change in the error

  cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS
OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -Od -MD -Zi -DDEBUGGING -TP -DPERL_EXTER
NAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\pp_ctl.obj ..\pp_ctl.c
pp_ctl.c
..\inline.h(264) : warning C4244​: '=' : conversion from 'long' to 'unsigned char
', possible loss of data
..\pp_ctl.c(125) : error C2446​: '​:' : no conversion from 'struct p5rx *(__cdecl
*)(struct sv **const ,int,struct op *,const struct regexp_engine *,struct p5rx
*,char *,unsigned long,unsigned long)' to 'struct p5rx *(__cdecl *const )(struct
sv **const ,int,struct op *,const struct regexp_engine *,struct p5rx *volatile
,char *,unsigned long,unsigned long)'
  This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
..\pp_ctl.c(129) : error C2064​: term does not evaluate to a function
NMAKE : fatal error U1077​: 'cl' : return code '0x2'


--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2014

From @tonycoz

On Sun Nov 17 20​:51​:40 2013, bulk88 wrote​:

..\pp_ctl.c(125) : error C2446​: '​:' : no conversion from 'struct p5rx
*(__cdecl
*)(struct sv **const ,int,struct op *,const struct regexp_engine
*,struct p5rx
*,char *,unsigned long,unsigned long)' to 'struct p5rx *(__cdecl
*const )(struct
sv **const ,int,struct op *,const struct regexp_engine *,struct p5rx
*volatile
,char *,unsigned long,unsigned long)'
This conversion requires a reinterpret_cast, a C-style cast or
function-
style cast
..\pp_ctl.c(129) : error C2064​: term does not evaluate to a function
NMAKE : fatal error U1077​: 'cl' : return code '0x2'

I suspect it's the volatime on th the p5rx parameter.

Which the compiler shouldn't consider part of the function type.

Tony

@p5pRT p5pRT added the hasPatch label Oct 19, 2019
@xenu
Copy link
Member

xenu commented Oct 22, 2019

We no longer support Visual C++ 6, see 7adf247.

@xenu xenu closed this as completed Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants