You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/21 12:20:49 UTC

[1/2] git commit: Fix CFCUtil_warn to not use fprintf

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master e8b0af8db -> bd045a8af


Fix CFCUtil_warn to not use fprintf

Under ActivePerl/MSVC, the call to fprintf caused a crash. This is
probably due to a combination of

- Perl redefining fprintf and/or stderr
- Different MSVCRT versions used to compile Perl and Clownfish

Switching to Perl's warnings API fixes the crash.

Also use the simpler vcroak for CFCUtil_die.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/64cac460
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/64cac460
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/64cac460

Branch: refs/heads/master
Commit: 64cac46021599d019bba9f31c38a54fd5cb7f249
Parents: e8b0af8
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 21 11:50:22 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 21 11:50:22 2014 +0200

----------------------------------------------------------------------
 compiler/src/CFCUtil.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/64cac460/compiler/src/CFCUtil.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index 7d8f7a5..fdcfe7a 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -495,23 +495,18 @@ CFCUtil_closedir(void *dirhandle, const char *dir) {
 
 void
 CFCUtil_die(const char* format, ...) {
-    SV *errsv = get_sv("@", 1);
     va_list args;
     va_start(args, format);
-    sv_vsetpvf_mg(errsv, format, &args);
+    vcroak(format, &args);
     va_end(args);
-    croak(NULL);
 }
 
 void
 CFCUtil_warn(const char* format, ...) {
-    SV *mess = newSVpv("", 0);
     va_list args;
     va_start(args, format);
-    sv_vsetpvf(mess, format, &args);
+    vwarn(format, &args);
     va_end(args);
-    fprintf(stderr, "%s\n", SvPV_nolen(mess));
-    SvREFCNT_dec(mess);
 }
 
 #else


[2/2] git commit: Always compile as C++ with MSVC

Posted by nw...@apache.org.
Always compile as C++ with MSVC

Although the generated XS is C89-compliant now, it must be compiled in
C++ mode like the rest of the code due to a mismatch between the sizes
of the C++ bool type and the emulated bool type.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/bd045a8a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/bd045a8a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/bd045a8a

Branch: refs/heads/master
Commit: bd045a8afefda3ea26c37fdc4928225cded046a1
Parents: 64cac46
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 21 12:15:56 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 21 12:15:56 2014 +0200

----------------------------------------------------------------------
 runtime/perl/buildlib/Clownfish/Build.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bd045a8a/runtime/perl/buildlib/Clownfish/Build.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build.pm b/runtime/perl/buildlib/Clownfish/Build.pm
index 85de0b2..481ab25 100644
--- a/runtime/perl/buildlib/Clownfish/Build.pm
+++ b/runtime/perl/buildlib/Clownfish/Build.pm
@@ -69,6 +69,17 @@ sub new {
     };
     my $self = $class->SUPER::new( recursive_test_files => 1, %args );
 
+    # Fix for MSVC: Although the generated XS should be C89-compliant, it
+    # must be compiled in C++ mode like the rest of the code due to a
+    # mismatch between the sizes of the C++ bool type and the emulated bool
+    # type. (The XS code is compiled with Module::Build's extra compiler
+    # flags, not the Clownfish cflags.)
+    if ($Config{cc} =~ /^cl\b/) {
+        my $extra_cflags = $self->extra_compiler_flags;
+        push @$extra_cflags, '/TP';
+        $self->extra_compiler_flags(@$extra_cflags);
+    }
+
     if ( $ENV{LUCY_VALGRIND} ) {
         my $optimize = $self->config('optimize') || '';
         $optimize =~ s/\-O\d+/-O1/g;