<commit_before>#!/usr/bin/perl
use warnings;

sub usage
{
	print STDERR "Usage: $0 [-v] source-file match [match2...] [flags]\n";
	print STDERR " match lists architectures followed by a match:\n";
	print STDERR " 'x86,x86_64:abc' 'x86_64:/xyz/' -fcommon\n";
}

sub check_codegen;

my $verbose = 0;
if($ARGV[0] eq '-v'){
	$verbose = 1;
	shift;
}

my $src = $ARGV[0] or die "no src";
shift;

my @matches;
while(@ARGV && $ARGV[0] !~ /^-/){
	push @matches, $ARGV[0];
	shift;
}

die "no matches"
unless @matches;

my @flags = @ARGV;

my $ucc = $ENV{UCC} or die "no \$UCC";
chomp(my $arch = `uname -m`);

my @src_output = map { chomp; $_ } `$ucc -S -o- @flags '$src'`;

my $found_arch = 0;
for(@matches){
	/(.*):(.*)/;
	my($arches, $match) = ($1, $2);

	for(split /,/, $arches){
		if($_ eq $arch){
			check_codegen($match, @src_output);
			$found_arch = 1;
		}
	}
}

die "arch '$arch' not in $src"
unless $found_arch;<commit_msg>Clarify "no matches" archgen error<commit_after>#!/usr/bin/perl
use warnings;

sub usage
{
	print STDERR "Usage: $0 [-v] source-file match [match2...] [flags]\n";
	print STDERR " match lists architectures followed by a match:\n";
	print STDERR " 'x86,x86_64:abc' 'x86_64:/xyz/' -fcommon\n";
}

sub check_codegen;

my $verbose = 0;
if($ARGV[0] eq '-v'){
	$verbose = 1;
	shift;
}

my $src = $ARGV[0] or die "no src";
shift;

my @matches;
while(@ARGV && $ARGV[0] !~ /^-/){
	push @matches, $ARGV[0];
	shift;
}

die "no matches given"
unless @matches;

my @flags = @ARGV;

my $ucc = $ENV{UCC} or die "no \$UCC";
chomp(my $arch = `uname -m`);

my @src_output = map { chomp; $_ } `$ucc -S -o- @flags '$src'`;

my $found_arch = 0;
for(@matches){
	/(.*):(.*)/;
	my($arches, $match) = ($1, $2);

	for(split /,/, $arches){
		if($_ eq $arch){
			check_codegen($match, @src_output);
			$found_arch = 1;
		}
	}
}

die "arch '$arch' not in $src"
unless $found_arch;
{'fraction_non_alphanumeric': 0.2210357714895889, 'fraction_numerical': 0.023491724506139882, 'mean_word_length': 3.708542713567839, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5239938', 'n_tokens_mistral': 871, 'n_tokens_neox': 823, 'n_words': 220}