<commit_before>use strict;
use warnings;

use lib '../clownfish/lib';
use lib 'clownfish/lib';

package Lucy::Build::CBuilder;
BEGIN { our @ISA = "ExtUtils::CBuilder"; }
use Config;

sub new {
    my $class = shift;
    require ExtUtils::CBuilder;
    return $class->SUPER::new(@_);
}

# This method isn't implemented by CBuilder for Windows, so we issue a basic
# link command that works on at least one system and hope for the best.
sub link_executable {
    my ( $self, %args ) = @_;
    if ( $Config{cc} eq 'cl' ) {
        my ( $objects, $exe_file ) = @args{qw( objects exe_file )};
        $self->do_system("link /out:$exe_file @$objects");
        return $exe_file;
    }
    else {
        return $self->SUPER::link_executable(%args);
    }
}

package Lucy::Build;
use base qw( Module::Build );

use File::Spec::Functions
    qw( catdir catfile curdir splitpath updir no_upwards );
use File::Path qw( mkpath rmtree );
use File::Copy qw( copy move );
use File::Find qw( find );
use Config;
use Env qw( @PATH );
use Fcntl;
use Carp;

BEGIN { unshift @PATH, curdir() }

sub xs_filepath { catfile( 'lib', "Lucy.xs" ) }
sub autobind_pm_path { catfile( 'lib', 'Lucy', 'Autobinding.pm' ); }

sub extra_ccflags {
    my $self          = shift;
    my $debug_env_var = "LUCY_DEBUG";

    my $extra_ccflags = "";
    if ( defined $ENV{$debug_env_var} ) {
        $extra_ccflags .= "-D$debug_env_var ";
        # Allow override when Perl was compiled with an older version.
        my $gcc_version = $ENV{REAL_GCC_VERSION} || $Config{gccversion};
        if ( defined $gcc_version ) {
            $gcc_version =~ /^(\d+(\.\d+)?)/ or die "no match";
            $gcc_version = $1;
            $extra_ccflags .= "-DPERL_GCC_PEDANTIC -std=c99 -pedantic -Wall ";
            $extra_ccflags .= "-Wextra " if $gcc_version >= 3.4;    # correct
            $extra_ccflags .= "-Wno-variadic-macros "
                if $gcc_version > 3.4;    # at least not on gcc 3.4
        }
    }

    # Compile as C++ under MSVC.
    if ( $Config{cc} eq 'cl' ) {
        $extra_ccflags .= '/TP ';
    }

    return $extra_ccflags;
}
<commit_msg>Always build under C99 with GCC.<commit_after>use strict;
use warnings;

use lib '../clownfish/lib';
use lib 'clownfish/lib';

package Lucy::Build::CBuilder;
BEGIN { our @ISA = "ExtUtils::CBuilder"; }
use Config;

sub new {
    my $class = shift;
    require ExtUtils::CBuilder;
    return $class->SUPER::new(@_);
}

# This method isn't implemented by CBuilder for Windows, so we issue a basic
# link command that works on at least one system and hope for the best.
sub link_executable {
    my ( $self, %args ) = @_;
    if ( $Config{cc} eq 'cl' ) {
        my ( $objects, $exe_file ) = @args{qw( objects exe_file )};
        $self->do_system("link /out:$exe_file @$objects");
        return $exe_file;
    }
    else {
        return $self->SUPER::link_executable(%args);
    }
}

package Lucy::Build;
use base qw( Module::Build );

use File::Spec::Functions
    qw( catdir catfile curdir splitpath updir no_upwards );
use File::Path qw( mkpath rmtree );
use File::Copy qw( copy move );
use File::Find qw( find );
use Config;
use Env qw( @PATH );
use Fcntl;
use Carp;

BEGIN { unshift @PATH, curdir() }

sub xs_filepath { catfile( 'lib', "Lucy.xs" ) }
sub autobind_pm_path { catfile( 'lib', 'Lucy', 'Autobinding.pm' ); }

sub extra_ccflags {
    my $self          = shift;
    my $debug_env_var = "LUCY_DEBUG";

    my $extra_ccflags = "";
    if ( defined $ENV{$debug_env_var} ) {
        $extra_ccflags .= "-D$debug_env_var ";
        # Allow override when Perl was compiled with an older version.
        my $gcc_version = $ENV{REAL_GCC_VERSION} || $Config{gccversion};
        if ( defined $gcc_version ) {
            $gcc_version =~ /^(\d+(\.\d+)?)/ or die "no match";
            $gcc_version = $1;
            $extra_ccflags .= "-DPERL_GCC_PEDANTIC -std=c99 -pedantic -Wall ";
            $extra_ccflags .= "-Wextra " if $gcc_version >= 3.4;    # correct
            $extra_ccflags .= "-Wno-variadic-macros "
                if $gcc_version > 3.4;    # at least not on gcc 3.4
        }
    }

    # Compile as C++ under MSVC.
    if ( $Config{cc} eq 'cl' ) {
        $extra_ccflags .= '/TP ';
    }

    # Tell GCC explicitly to run with C99 compatability.
    my $gcc_version = $ENV{REAL_GCC_VERSION} || $Config{gccversion};
    if ( defined $gcc_version ) {
        $gcc_version =~ /^(\d+(\.\d+)?)/ or die "no match";
        $gcc_version = $1;
        if ($extra_ccflags !~ m/-std=c99/) {
            $extra_ccflags .= "-std=c99 ";
        }  
    }

    return $extra_ccflags;
}

{'fraction_non_alphanumeric': 0.14734561213434452, 'fraction_numerical': 0.0058504875406283855, 'mean_word_length': 2.623233908948195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '940095', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1606, 'n_words': 445}