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

Embedding perl with -DPERL_NO_SHORT_NAMES is not -Wall clean #14168

Open
p5pRT opened this issue Oct 18, 2014 · 11 comments
Open

Embedding perl with -DPERL_NO_SHORT_NAMES is not -Wall clean #14168

p5pRT opened this issue Oct 18, 2014 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 18, 2014

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

Searchable as RT123006$

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2014

From afresh1@openbsd.org

Created by afresh1@openbsd.org

When trying to build an embedded perl with -Wall and -DPERL_NO_SHORT_NAMES, cc
complains about implicit declaration of mg_size and different utf8 functions.

This may be something I am missing in perlembed.

$ cat perlbomb.c
#include <EXTERN.h>
#include <perl.h>

int
main(int argc, char *argv[])
{
  return (0);
}

$ cc -Wall -I. -DPERL_NO_SHORT_NAMES -o perlbomb perlbomb.c

With blead​:
In file included from ./perl.h​:5600,
  from perlbomb.c​:2​:
./inline.h​: In function 'S_av_top_index'​:
./inline.h​:23​: warning​: implicit declaration of function 'mg_size'
./inline.h​: In function 'S__is_utf8_char_slow'​:
./inline.h​:242​: warning​: implicit declaration of function 'utf8n_to_uvchr'
/tmp//ccYk4Qs7.o(.text+0xb)​: In function `S_croak_memory_wrap'​:
: undefined reference to `PL_memory_wrap'
/tmp//ccYk4Qs7.o(.text+0x1c)​: In function `S_croak_memory_wrap'​:
: undefined reference to `Perl_croak'
collect2​: ld returned 1 exit status

with 5.20.1​:
In file included from ./perl.h​:5188,
  from perlbomb.c​:2​:
./inline.h​: In function 'S_av_top_index'​:
./inline.h​:23​: warning​: implicit declaration of function 'mg_size'
./inline.h​: In function 'S_isIDFIRST_lazy'​:
./inline.h​:277​: warning​: implicit declaration of function '_is_utf8_perl_idstart'
./inline.h​: In function 'S_isALNUM_lazy'​:
./inline.h​:285​: warning​: implicit declaration of function '_is_utf8_FOO'
/tmp//ccoPWIq9.o(.text+0xb)​: In function `S_croak_memory_wrap'​:
: undefined reference to `PL_memory_wrap'
/tmp//ccoPWIq9.o(.text+0x1c)​: In function `S_croak_memory_wrap'​:
: undefined reference to `Perl_croak'
collect2​: ld returned 1 exit status

with 5.18.2​:
In file included from /usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/perl.h​:5255,
  from perlbomb.c​:2​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function 'S_av_top_index'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:23​: warning​: implicit declaration of function 'mg_size'
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function 'S_isIDFIRST_lazy'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:147​: warning​: implicit declaration of function '_is_utf8_perl_idstart'
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function 'S_isALNUM_lazy'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:155​: warning​: implicit declaration of function '_is_utf8_FOO'

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl 5.21.5:

Configured by afresh1 at Sat Oct 18 12:31:53 PDT 2014.

Summary of my perl5 (revision 5 version 21 subversion 5) configuration:
  Commit id: 28482d6cad995d14acdad04e18ee2d4ee32c6a18
  Platform:
    osname=openbsd, osvers=5.6, archname=OpenBSD.amd64-openbsd
    uname='openbsd trillian.home.hewus.com 5.6 generic.mp#0 amd64 '
    config_args='-Dmksymlinks -Dusedevel -de'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='4.2.1 20070719 ', gccosandvers='openbsd5.6'
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E  -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lgdbm -lm -lutil -lc
    perllibs=-lm -lutil -lc
    libc=/usr/lib/libc.so.77.2, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC ', lddlflags='-shared -fPIC  -L/usr/local/lib -fstack-protector-strong'



@INC for perl 5.21.5:
    lib
    /usr/local/lib/perl5/site_perl/5.21.5/OpenBSD.amd64-openbsd
    /usr/local/lib/perl5/site_perl/5.21.5
    /usr/local/lib/perl5/5.21.5/OpenBSD.amd64-openbsd
    /usr/local/lib/perl5/5.21.5
    .


Environment for perl 5.21.5:
    HOME=/home/afresh1
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=en_US.UTF-8
    LD_LIBRARY_PATH=/mnt/memory/perl
    LOGDIR (unset)
    PATH=/home/afresh1/.plenv/shims:/home/afresh1/.plenv/bin:/home/afresh1/bin:/home/afresh1/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:/home/afresh1/.plenv/bin:.
    PERL_BADLANG (unset)
    SHELL=/bin/ksh

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2014

From @jkeenan

On Sat Oct 18 14​:46​:31 2014, afresh1@​openbsd.org wrote​:

This is a bug report for perl from afresh1@​openbsd.org,
generated with the help of perlbug 1.40 running under perl 5.21.5.

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

When trying to build an embedded perl with -Wall and
-DPERL_NO_SHORT_NAMES, cc
complains about implicit declaration of mg_size and different utf8
functions.

This may be something I am missing in perlembed.

$ cat perlbomb.c
#include <EXTERN.h>
#include <perl.h>

int
main(int argc, char *argv[])
{
return (0);
}

$ cc -Wall -I. -DPERL_NO_SHORT_NAMES -o perlbomb perlbomb.c

With blead​:
In file included from ./perl.h​:5600,
from perlbomb.c​:2​:
./inline.h​: In function 'S_av_top_index'​:
./inline.h​:23​: warning​: implicit declaration of function 'mg_size'
./inline.h​: In function 'S__is_utf8_char_slow'​:
./inline.h​:242​: warning​: implicit declaration of function
'utf8n_to_uvchr'
/tmp//ccYk4Qs7.o(.text+0xb)​: In function `S_croak_memory_wrap'​:
: undefined reference to `PL_memory_wrap'
/tmp//ccYk4Qs7.o(.text+0x1c)​: In function `S_croak_memory_wrap'​:
: undefined reference to `Perl_croak'
collect2​: ld returned 1 exit status

with 5.20.1​:
In file included from ./perl.h​:5188,
from perlbomb.c​:2​:
./inline.h​: In function 'S_av_top_index'​:
./inline.h​:23​: warning​: implicit declaration of function 'mg_size'
./inline.h​: In function 'S_isIDFIRST_lazy'​:
./inline.h​:277​: warning​: implicit declaration of function
'_is_utf8_perl_idstart'
./inline.h​: In function 'S_isALNUM_lazy'​:
./inline.h​:285​: warning​: implicit declaration of function
'_is_utf8_FOO'
/tmp//ccoPWIq9.o(.text+0xb)​: In function `S_croak_memory_wrap'​:
: undefined reference to `PL_memory_wrap'
/tmp//ccoPWIq9.o(.text+0x1c)​: In function `S_croak_memory_wrap'​:
: undefined reference to `Perl_croak'
collect2​: ld returned 1 exit status

with 5.18.2​:
In file included from /usr/libdata/perl5/amd64-
openbsd/5.18.2/CORE/perl.h​:5255,
from perlbomb.c​:2​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function
'S_av_top_index'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:23​: warning​:
implicit declaration of function 'mg_size'
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function
'S_isIDFIRST_lazy'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:147​: warning​:
implicit declaration of function '_is_utf8_perl_idstart'
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function
'S_isALNUM_lazy'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:155​: warning​:
implicit declaration of function '_is_utf8_FOO'

On Linux, I tried to write and execute a program similar to your perlbomb.c. Results attached.

But I have to confess that I don't understand why you are trying to compile a C program while including two Perl-specific headers. Can you clarify?

Also, can you explain what this has to do with trying to build an embedded perl? That's a subject with which I (and I suspect many others) have no experience.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2014

From @jkeenan

$ cat perlbomb.c
#include </home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/EXTERN.h>
#include </home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/perl.h>
int main(int argc, char *argv[])
{
  return (0);
}

$ cc -Wall -I. -DPERL_NO_SHORT_NAMES -o perlbomb perlbomb.c
In file included from /home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/perl.h​:5188​:0,
  from perlbomb.c​:2​:
/home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/inline.h​: In function ‘S_av_top_index’​:
/home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/inline.h​:23​:5​: warning​: implicit declaration of function ‘mg_size’ [-Wimplicit-function-declaration]
  return AvFILL(av);
  ^
In file included from /home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/perl.h​:5188​:0,
  from perlbomb.c​:2​:
/home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/inline.h​: In function ‘S_isIDFIRST_lazy’​:
/home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/inline.h​:277​:5​: warning​: implicit declaration of function ‘_is_utf8_perl_idstart’ [-Wimplicit-function-declaration]
  return isIDFIRST_lazy_if(p,1);
  ^
/home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/inline.h​: In function ‘S_isALNUM_lazy’​:
/home/jkeenan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/CORE/inline.h​:285​:5​: warning​: implicit declaration of function ‘_is_utf8_FOO’ [-Wimplicit-function-declaration]
  return isALNUM_lazy_if(p,1);
  ^
/tmp/ccJfQ6M6.o​: In function `S_croak_memory_wrap'​:
perlbomb.c​:(.text+0x5)​: undefined reference to `PL_memory_wrap'
perlbomb.c​:(.text+0x14)​: undefined reference to `Perl_croak'
collect2​: error​: ld returned 1 exit status

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2014

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

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2014

From andrew@afresh1.com

I'm including those headers as directed in the perlembed manual. This would be used to include a perl interpreter in a program that isn't perl.

http​://perldoc.perl.org/perlembed.html

On October 18, 2014 3​:13​:11 PM PDT, James E Keenan via RT <perlbug-followup@​perl.org> wrote​:

On Sat Oct 18 14​:46​:31 2014, afresh1@​openbsd.org wrote​:

This is a bug report for perl from afresh1@​openbsd.org,
generated with the help of perlbug 1.40 running under perl 5.21.5.

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

When trying to build an embedded perl with -Wall and
-DPERL_NO_SHORT_NAMES, cc
complains about implicit declaration of mg_size and different utf8
functions.

This may be something I am missing in perlembed.

$ cat perlbomb.c
#include <EXTERN.h>
#include <perl.h>

int
main(int argc, char *argv[])
{
return (0);
}

$ cc -Wall -I. -DPERL_NO_SHORT_NAMES -o perlbomb perlbomb.c

With blead​:
In file included from ./perl.h​:5600,
from perlbomb.c​:2​:
./inline.h​: In function 'S_av_top_index'​:
./inline.h​:23​: warning​: implicit declaration of function 'mg_size'
./inline.h​: In function 'S__is_utf8_char_slow'​:
./inline.h​:242​: warning​: implicit declaration of function
'utf8n_to_uvchr'
/tmp//ccYk4Qs7.o(.text+0xb)​: In function `S_croak_memory_wrap'​:
: undefined reference to `PL_memory_wrap'
/tmp//ccYk4Qs7.o(.text+0x1c)​: In function `S_croak_memory_wrap'​:
: undefined reference to `Perl_croak'
collect2​: ld returned 1 exit status

with 5.20.1​:
In file included from ./perl.h​:5188,
from perlbomb.c​:2​:
./inline.h​: In function 'S_av_top_index'​:
./inline.h​:23​: warning​: implicit declaration of function 'mg_size'
./inline.h​: In function 'S_isIDFIRST_lazy'​:
./inline.h​:277​: warning​: implicit declaration of function
'_is_utf8_perl_idstart'
./inline.h​: In function 'S_isALNUM_lazy'​:
./inline.h​:285​: warning​: implicit declaration of function
'_is_utf8_FOO'
/tmp//ccoPWIq9.o(.text+0xb)​: In function `S_croak_memory_wrap'​:
: undefined reference to `PL_memory_wrap'
/tmp//ccoPWIq9.o(.text+0x1c)​: In function `S_croak_memory_wrap'​:
: undefined reference to `Perl_croak'
collect2​: ld returned 1 exit status

with 5.18.2​:
In file included from /usr/libdata/perl5/amd64-
openbsd/5.18.2/CORE/perl.h​:5255,
from perlbomb.c​:2​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function
'S_av_top_index'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:23​: warning​:
implicit declaration of function 'mg_size'
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function
'S_isIDFIRST_lazy'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:147​: warning​:
implicit declaration of function '_is_utf8_perl_idstart'
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​: In function
'S_isALNUM_lazy'​:
/usr/libdata/perl5/amd64-openbsd/5.18.2/CORE/inline.h​:155​: warning​:
implicit declaration of function '_is_utf8_FOO'

On Linux, I tried to write and execute a program similar to your
perlbomb.c. Results attached.

But I have to confess that I don't understand why you are trying to
compile a C program while including two Perl-specific headers. Can you
clarify?

Also, can you explain what this has to do with trying to build an
embedded perl? That's a subject with which I (and I suspect many
others) have no experience.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2014

From @cpansprout

On Sat Oct 18 14​:46​:31 2014, afresh1@​openbsd.org wrote​:

This is a bug report for perl from afresh1@​openbsd.org,
generated with the help of perlbug 1.40 running under perl 5.21.5.

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

When trying to build an embedded perl with -Wall and
-DPERL_NO_SHORT_NAMES, cc
complains about implicit declaration of mg_size and different utf8
functions.

This may be something I am missing in perlembed.

PERL_NO_SHORT_NAMES is, unfortunately, unmaintained, and has been for a long time (maybe even a decade or more?). We have no infrastructure for testing it. Nor do we have any convention for documenting which items in perlapi.pod are macros (for which the Perl_ prefix would not work), and this has changed back and forth for many functions/macros.

I wonder whether we should just remove it from perlembed.pod, or altogether. But there is certainly room for conflict with other C headers. So I don’t see any easy solution.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Oct 21, 2014

From @Leont

On Sun, Oct 19, 2014 at 1​:19 AM, Father Chrysostomos via RT <
perlbug-followup@​perl.org> wrote​:

PERL_NO_SHORT_NAMES is, unfortunately, unmaintained, and has been for a
long time (maybe even a decade or more?). We have no infrastructure for
testing it. Nor do we have any convention for documenting which items in
perlapi.pod are macros (for which the Perl_ prefix would not work), and
this has changed back and forth for many functions/macros.

I wonder whether we should just remove it from perlembed.pod, or
altogether. But there is certainly room for conflict with other C
headers. So I don’t see any easy solution.

I successfully used it on 5.8, but 5.10 broke all hash functions. In
general, the capitalization pattern of things gives away their macroness,
but their are enough exceptions that relying on it isn't really tenable.

Leon

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2014

From @tonycoz

On Sat Oct 18 16​:19​:44 2014, sprout wrote​:

PERL_NO_SHORT_NAMES is, unfortunately, unmaintained, and has been for
a long time (maybe even a decade or more?). We have no infrastructure
for testing it.

That isn't too hard to test, since we already test embedding. Patches attached.

Nor do we have any convention for documenting which
items in perlapi.pod are macros (for which the Perl_ prefix would not
work), and this has changed back and forth for many functions/macros.

This is the main problem. What should be available under PERL_NO_SHORT_NAMES?

Should PL_* variables be available?

I wonder whether we should just remove it from perlembed.pod, or
altogether. But there is certainly room for conflict with other C
headers. So I don’t see any easy solution.

Tony

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2014

From @tonycoz

0001-Test-More-ify-lib-ExtUtils-t-Embed.t.patch
From 84f5da0cd316cbeeed8b3bc635ecce7cdca31a07 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 30 Oct 2014 11:55:52 +1100
Subject: Test::More ify lib/ExtUtils/t/Embed.t

---
 lib/ExtUtils/t/Embed.t |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t
index 4e05cfe..72e0726 100644
--- a/lib/ExtUtils/t/Embed.t
+++ b/lib/ExtUtils/t/Embed.t
@@ -12,6 +12,7 @@ use Config;
 use ExtUtils::Embed;
 use File::Spec;
 use IPC::Cmd qw(can_run);
+use Test::More;
 
 my $cc = $Config{'cc'};
 if ( $Config{usecrosscompile} && !can_run($cc) ) {
@@ -23,7 +24,7 @@ print $fh <DATA>;
 close($fh);
 
 $| = 1;
-print "1..10\n";
+plan tests => 3;
 
 my $cl  = ($^O eq 'MSWin32' && $cc eq 'cl');
 my $skip_exe = $^O eq 'os2' && $Config{ldflags} =~ /(?<!\S)-Zexe\b/;
@@ -136,13 +137,18 @@ if ($^O eq 'VMS' && !$status) {
   print "# @cmd2\n";
   $status = system(join(' ',@cmd2));
 }
-print (($status? 'not ': '')."ok 1\n");
+is($status, 0, "build correctly");
 
 my $embed_test = File::Spec->catfile(File::Spec->curdir, $exe);
 $embed_test = "run/nodebug $exe" if $^O eq 'VMS';
 print "# embed_test = $embed_test\n";
-$status = system($embed_test);
-print (($status? 'not ':'')."ok 10 # system returned $status\n");
+@out = `$embed_test`;
+chomp @out;
+is_deeply(\@out,
+	  [ map "ok $_", 2..9 ],
+	  "check test output");
+$status = $?;
+is($status, 0, "embedded code run correctly");
 unlink($exe,"embed_test.c",$obj);
 unlink("$exe.manifest") if $cl and $Config{'ccversion'} =~ /^(\d+)/ and $1 >= 14;
 unlink("$exe$Config{exe_ext}") if $skip_exe;
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2014

From @tonycoz

0002-roughly-fix-the-build-failures-for-PERL_NO_SHORT_NAM.patch
From 4037d43257122e5784acf54ddd834cdfe76e1e1b Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 30 Oct 2014 12:07:41 +1100
Subject: roughly "fix" the build failures for PERL_NO_SHORT_NAMES builds

The AvFILL() definition uses mg_size(), a different solution would
be to change the AvFILL() definition to use Perl_mg_size().

The S__is_utf8_char_slow() change should be obvious.

All subject to change as we nail down what should be exposed under
PERL_NO_SHORT_NAMES.
---
 inline.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/inline.h b/inline.h
index 5256e8c..63f9fa3 100644
--- a/inline.h
+++ b/inline.h
@@ -14,6 +14,8 @@
 
 /* ------------------------------- av.h ------------------------------- */
 
+#ifndef PERL_NO_SHORT_NAMES
+
 PERL_STATIC_INLINE SSize_t
 S_av_top_index(pTHX_ AV *av)
 {
@@ -23,6 +25,8 @@ S_av_top_index(pTHX_ AV *av)
     return AvFILL(av);
 }
 
+#endif
+
 /* ------------------------------- cv.h ------------------------------- */
 
 PERL_STATIC_INLINE GV *
@@ -239,7 +243,7 @@ S__is_utf8_char_slow(const U8 *s, const U8 *e)
     PERL_ARGS_ASSERT__IS_UTF8_CHAR_SLOW;
 
     assert(e >= s);
-    utf8n_to_uvchr(s, e - s, &actual_len, UTF8_CHECK_ONLY);
+    Perl_utf8n_to_uvchr(aTHX_ s, e - s, &actual_len, UTF8_CHECK_ONLY);
 
     return (actual_len == (STRLEN) -1) ? 0 : actual_len;
 }
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2014

From @tonycoz

0003-test-that-embedding-works-with-PERL_NO_SHORT_NAMES-d.patch
From 55fb4a018a8dea027c6ffcdf24489d995ed4531a Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 30 Oct 2014 12:08:09 +1100
Subject: test that embedding works with PERL_NO_SHORT_NAMES defined

---
 lib/ExtUtils/t/Embed.t |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t
index 72e0726..f01a14c 100644
--- a/lib/ExtUtils/t/Embed.t
+++ b/lib/ExtUtils/t/Embed.t
@@ -24,8 +24,9 @@ print $fh <DATA>;
 close($fh);
 
 $| = 1;
-plan tests => 3;
+plan tests => 6;
 
+for my $short_names (0, 1) {
 my $cl  = ($^O eq 'MSWin32' && $cc eq 'cl');
 my $skip_exe = $^O eq 'os2' && $Config{ldflags} =~ /(?<!\S)-Zexe\b/;
 my $exe = 'embed_test';
@@ -53,6 +54,7 @@ if ($^O eq 'VMS') {
     }
     $crazy =~ s#/Obj[^=/]*=[\w\$\_\-\.\[\]\:]+##i;
     push(@cmd,"/Include=(".join(',',@incs).")");
+    push(@cmd, "/Define=PERL_NO_SHORT_NAMES") if $short_names;
     push(@cmd,$crazy);
     push(@cmd,"embed_test.c");
 
@@ -74,6 +76,7 @@ if ($^O eq 'VMS') {
    }
 
    push(@cmd,"-I$inc",ccflags(),'embed_test.c');
+   push(@cmd, "-DPERL_NO_SHORT_NAMES") if $short_names;
    if ($^O eq 'MSWin32') {
     $inc = File::Spec->catdir($inc,'win32');
     push(@cmd,"-I$inc");
@@ -149,12 +152,15 @@ is_deeply(\@out,
 	  "check test output");
 $status = $?;
 is($status, 0, "embedded code run correctly");
-unlink($exe,"embed_test.c",$obj);
+unlink($exe,$obj);
 unlink("$exe.manifest") if $cl and $Config{'ccversion'} =~ /^(\d+)/ and $1 >= 14;
 unlink("$exe$Config{exe_ext}") if $skip_exe;
 unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS';
 unlink(glob("./*.dll")) if $^O eq 'cygwin';
 unlink($testlib)	       if $libperl_copied;
+}
+
+unlink("embed_test.c");
 
 # gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccflags -e ldopts`
 __END__
-- 
1.7.10.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants