From 5d51fe97953be353d9523618b408b45cfed4de4d Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 23 Jan 2015 13:41:31 -0800 Subject: [PATCH] c2english.pl: show usage if no code, and add -Wno-implicit --- modules/c2english.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/c2english.pl b/modules/c2english.pl index f9858e8a..7278c39d 100755 --- a/modules/c2english.pl +++ b/modules/c2english.pl @@ -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 \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;