c2english.pl: show usage if no code, and add -Wno-implicit

This commit is contained in:
Pragmatic Software 2015-01-23 13:41:31 -08:00
parent 938561a2fb
commit 5d51fe9795
1 changed files with 8 additions and 2 deletions

View File

@ -11,6 +11,12 @@ no if $] >= 5.018, warnings => 'experimental::smartmatch';
my $debug = 0;
my $code = join ' ', @ARGV;
if (not length $code) {
print "Usage: english <any C11 code>\n";
exit;
}
my $output;
my $force;
@ -304,7 +310,7 @@ print $fh $code;
close $fh;
#my ($ret, $result) = execute(10, "gcc -std=c89 -pedantic -Werror -Wno-unused -fsyntax-only -fno-diagnostics-show-option -fno-diagnostics-show-caret code.c");
my ($ret, $result) = execute(10, "gcc -std=c11 -pedantic -Werror -Wno-unused -fsyntax-only -fno-diagnostics-show-option -fno-diagnostics-show-caret code.c");
my ($ret, $result) = execute(10, "gcc -std=c11 -pedantic -Werror -Wno-implicit -Wno-unused -fsyntax-only -fno-diagnostics-show-option -fno-diagnostics-show-caret code.c");
if(not $force and $ret != 0) {
$output = $result;
@ -348,7 +354,7 @@ if(not $force and $ret != 0) {
$output =~ s/\\0"/"/g;
$output =~ s/"\\0/"/g;
$output =~ s/\.\.\.>/>/g;
$output =~ s/(\\\d{3})+//g;
# $output =~ s/(\\\d{3})+//g;
$output =~ s/<\s*included at \/home\/compiler\/>\s*//g;
$output =~ s/\s*compilation terminated due to -Wfatal-errors\.//g;
$output =~ s/^======= Backtrace.*\[vsyscall\]\s*$//ms;