develooper Front page | perl.perl5.porters | Postings from October 2014

[perl #122911] commit "add op_comp field to regexp_engine API" caused a function pointer prototype mismatch

Thread Previous
From:
bulk88
Date:
October 5, 2014 18:36
Subject:
[perl #122911] commit "add op_comp field to regexp_engine API" caused a function pointer prototype mismatch
Message ID:
rt-4.0.18-12803-1412534173-36.122911-75-0@perl.org
# New Ticket Created by  bulk88 
# Please include the string:  [perl #122911]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122911 >


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


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

Commit "add op_comp field to regexp_engine API" 
3c13cae629d936c43bca9d992cc445d93287af8e by Dave M added a compiler 
warning on VC 6, that needs to get silenced.

-----------------------------------------------------------------
        cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 
-D_CONS
OLE -DNO_STRICT -DPERLDLL -DPERL_CORE   -O1 -MD -Zi -DNDEBUG 
-DPERL_EXTERNAL_GLO
B -DPERL_IS_MINIPERL -Fo.\mini\pp_ctl.obj ..\pp_ctl.c
pp_ctl.c
..\pp_ctl.c(122) : warning C4028: formal parameter 5 different from 
declaration
-----------------------------------------------------------------
    new_re = (eng->op_comp
            ? eng->op_comp
            : &Perl_re_op_compile
        )(aTHX_ args, nargs, pm->op_code_list, eng, re,<<<<<Line 122
        &is_bare_re,
                (pm->op_pmflags & RXf_PMf_FLAGCOPYMASK),
        pm->op_pmflags |
            (PL_op->op_flags & OPf_SPECIAL ? PMf_USE_RE_EVAL : 0));
-----------------------------------------------------------------

In the commit Dave M added a "VOL" token which becomes volatile after 
CPP, commit message doesn't give any clue to why its there (WAG, 
compiler bug somewhere? if so it must be documented).

----------------------------------- regexp.h 
-----------------------------------
index 8b19055..b4427d3 100644
@@ -159,14 +159,18 @@ typedef struct regexp_engine {
                            SV * const value, const U32 flags);
     SV*     (*named_buff_iter) (pTHX_ REGEXP * const rx, const SV * 
const lastkey,
                                 const U32 flags);
     SV*     (*qr_package)(pTHX_ REGEXP * const rx);
 #ifdef USE_ITHREADS
     void*   (*dupe) (pTHX_ REGEXP * const rx, CLONE_PARAMS *param);
 #endif
+    REGEXP* (*op_comp) (pTHX_ SV ** const patternp, int pat_count,
+            OP *expr, const struct regexp_engine* eng,
+            REGEXP *VOL old_re,
+            int *is_bare_re, U32 orig_rx_flags, U32 pm_flags);
 } regexp_engine;
--------------------------------------------------------
expanded CPP
-------------------------------------------------------
    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);
-------------------------------------------------------

but the prototype of function pointer Perl_re_op_compile (the other 
operand of the ?:) doesnt have volatile flag, and triggers the "warning 
C4028: formal parameter 5 different from declaration"

-------------------------------------------------------
REGEXP *
Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
            OP *expr, const regexp_engine* eng, REGEXP *old_re,
             bool *is_bare_re, U32 orig_rx_flags, U32 pm_flags)
{
-------------------------------------------------------

So why is volatile in proto for op_comp member?

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.21.2:

Configured by Owner at Tue Sep 23 02:37:36 2014.

Summary of my perl5 (revision 5 version 21 subversion 2) configuration:
  Derived from: 101c6642b743a0f82b7806d5a14d645731f1509c
  Ancestor: 8eaff90c13544b96799fc27a09c05dec3d2706c9
  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
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 
-D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_HASH_FUNC_ONE_AT_A_TIME -DPERL_IMPLICIT_CONTEXT 
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
    optimize='-Od -MD -Zi -DDEBUGGING',
    cppflags='-DWIN32'
    ccversion='13.10.6030', 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:\perl521\lib\CORE"  -machine:x86'
    libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\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=perl521.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug  
-libpath:"c:\perl521\lib\CORE"  -machine:x86'

Locally applied patches:
    uncommitted-changes
    22eb0703e4f1ca0305ca22390770b019a4b0ec4c
    ab36ae0a3ee81e650c6775a6e779fd961d14a2df
    7374111ae13f4be3f77c384a6ed74d26608a6d94
    543c0e688ee3c5a452b9203e04eee8a0f448ecfa
    68a4b64dc9a9688bb38aabd2dd076a93805c5d0a
    2bfbae23de43234000b13d68be2d6c2e17642f52
    d56c627eaf78528a30b6e2e11f11f4a310f6b738
    568f0b08dbad76dcd72664e258a9504bcc2b1246
    101c6642b743a0f82b7806d5a14d645731f1509c

---
@INC for perl 5.21.2:
    C:/perl521/site/lib
    C:/perl521/lib
    .

---
Environment for perl 5.21.2:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\perl521\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)


Thread Previous


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