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

[perl #116557] commit 8a45afe5 uses a WinCE SDK MS reserved word/macro

Thread Next
From:
bulk88
Date:
January 28, 2013 09:44
Subject:
[perl #116557] commit 8a45afe5 uses a WinCE SDK MS reserved word/macro
Message ID:
rt-3.6.HEAD-27190-1359366263-745.116557-75-0@perl.org
# New Ticket Created by  bulk88 
# Please include the string:  [perl #116557]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116557 >


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


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

This commit 
http://perl5.git.perl.org/perl.git/commit/8a45afe535d962511dc34619dcdb405aeff849da?f=op.c 
created a variable with the name "leave". In embedded VC 4's SDK's 
headers there is

________________________________________________________
#if     !defined(__cplusplus)
#define try                             __try
#define except                          __except
#define finally                         __finally
#define leave                           __leave
#endif
________________________________________________________
__leave is part of MS's non-standard SEH exception handling (see 
http://msdn.microsoft.com/en-us/library/yb3kz605.aspx ). It will error as
_______________________________________________________
op.c(4560) : error C2059: syntax error : '__leave'
op.c(4564) : error C2059: syntax error : '__leave'
op.c(4568) : error C2143: syntax error : missing ';' before '->'
op.c(4568) : error C2703: illegal __leave statement
op.c(4568) : error C2143: syntax error : missing ';' before '->'
op.c(4569) : error C2059: syntax error : '__leave'
op.c(4829) : error C2143: syntax error : missing '{' before '*'
op.c(4831) : error C2371: 'Perl_newSVOP' : redefinition; different basic 
types
        ..\proto.h(2825) : see declaration of 'Perl_newSVOP'
op.c(4852) : warning C4133: 'return' : incompatible types - from 'struct 
op *' t
o 'int *'
op.c(7343) : warning C4244: 'initializing' : conversion from 'unsigned 
long ' to
 'const char ', possible loss of data
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
_______________________________________________________

Other people also have this problem with eVC, 
http://comments.gmane.org/gmane.comp.lang.pcre.devel/2052 . You can also 
google "define leave __leave" and get alot of hits.

So what is done when OS headers turn non-macro looking things into 
macros? Does Perl avoid using that macro/token/identifier, or does Perl 
undef "bad" OS defines (and this leave/try/except/finally stuff is a 
"bad" OS define)? The current situation is a bug.

Here is some preprocessed stuff from blead of what happened in op.c

________________________________________________________
OP             *
Perl_pmruntime(OP * o, OP * expr, char isreg, I32 floor)
{
    extern int      Perl___notused(void);
    PMOP           *pm;
    LOGOP          *rcop;
    I32             repl_has_vars = 0;
    OP             *repl = 0;
    char            is_trans = (o->op_type == OP_TRANS || o->op_type == 
OP_TRANSR);
    char            is_compiletime;
    char            has_code;

    ;;

    if (is_trans || o->op_type == OP_SUBST) {
        OP             *kid;
        repl = ((LISTOP *) expr)->op_last;
        kid = ((LISTOP *) expr)->op_first;
        while (kid->op_sibling != repl)
            kid = kid->op_sibling;
        kid->op_sibling = 0;
        ((LISTOP *) expr)->op_last = kid;
    }

    if (is_trans) {
        OP             *const oe = expr;
        ;
        ;
        ;
        expr = ((LISTOP *) oe)->op_last;
        ((LISTOP *) oe)->op_first->op_sibling = 0;
        ((LISTOP *) oe)->op_last = 0;
        Perl_op_free(oe);

        return S_pmtrans(o, expr, repl);
    }

    is_compiletime = 1;
    has_code = 0;
    if (expr->op_type == OP_LIST) {
        OP             *o;
        for (o = ((LISTOP *) expr)->op_first; o; o = o->op_sibling) {
            if (o->op_type == OP_NULL && (o->op_flags & 128)) {
                has_code = 1;
                ;
                o->op_next = o->op_sibling;
            } else if (o->op_type != OP_CONST && o->op_type != OP_PUSHMARK)
                is_compiletime = 0;
        }
    } else if (expr->op_type != OP_CONST)
        is_compiletime = 0;

    ((expr)->op_next ? (expr)->op_next : Perl_op_linklist((OP *) expr));

    if (expr->op_type == OP_LIST) {
        OP             *o;
        for (o = ((LISTOP *) expr)->op_first; o; o = o->op_sibling) {
            if (!(o->op_type == OP_NULL && (o->op_flags & 128)))
                continue;
            o->op_next = 0;
            Perl_scalar(o);
            ((o)->op_next ? (o)->op_next : Perl_op_linklist((OP *) o));
            if (((LISTOP *) o)->op_first->op_type == OP_LEAVE) {
                LISTOP         *__leave = ((LISTOP *) ((LISTOP *) 
o)->op_first);

                ;
                ;
                o->op_next = __leave->op_first->op_sibling;

                ;
                ;
                __leave->op_next = 0;
                Perl_op_null((OP *) __leave);
            } else {

                OP             *scope = ((LISTOP *) o)->op_first;
                ;
                ;
                scope->op_next = 0;
                Perl_op_null(scope);
            }

            PL_peepp(o);
            if (is_compiletime)

                Perl_finalize_optree(o);
        }
    }

    PL_hints |= 0x00000100;
    pm = (PMOP *) o;
    ;

__________________________________________________________________


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

Configured by Owner at Sun Dec 16 13:25:34 2012.

Summary of my perl5 (revision 5 version 17 subversion 7 patch blead 
2012-12-06.16:42:20 93a641ae382638ffd1980378be4810244d04f4b0 
v5.17.6-186-g93a641a) configuration:
  Snapshot of: 93a641ae382638ffd1980378be4810244d04f4b0
  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 -MD -Zi -DNDEBUG -O1 -GL -G7 
-DWIN32 -D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO 
-D_USE_32BIT_TIME_T',
    optimize='-MD -Zi -DNDEBUG -O1 -GL -G7',
    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 -opt:ref,icf 
-ltcg  -libpath:"c:\perl517\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=perl517.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf -ltcg  -libpath:"c:\perl517\lib\CORE"  -machine:x86'

Locally applied patches:
    

---
@INC for perl 5.17.7:
    C:/perl517/site/lib
    C:/perl517/lib
    .

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


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