compiler_vm: add -Wshadow; support -include

This commit is contained in:
Pragmatic Software 2014-05-02 00:43:42 +00:00
parent c1fa37f982
commit 8e07eb300e
3 changed files with 15 additions and 8 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 562,
BUILD_REVISION => 563,
BUILD_DATE => "2014-05-01",
};

View File

@ -24,9 +24,9 @@ my $unshift_last_code = 0;
my $only_show = 0;
my %languages = (
'C11' => "gcc -std=c11 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -Wfatal-errors",
'C99' => "gcc -std=c99 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -Wfatal-errors",
'C89' => "gcc -std=c89 -pedantic -Wall -Wextra -Wno-unused -Wfatal-errors",
'C11' => "gcc -std=c11 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -Wshadow -Wfatal-errors",
'C99' => "gcc -std=c99 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -Wshadow -Wfatal-errors",
'C89' => "gcc -std=c89 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -Wshadow -Wfatal-errors",
);
my %preludes = (
@ -637,10 +637,17 @@ $got_paste = 1 and $extracted_args .= "-paste " if $code =~ s/(?<=\s)*-paste\s*/
my $got_nomain = undef;
$got_nomain = 1 and $extracted_args .= "-nomain " if $code =~ s/(?<=\s)*-nomain\s*//i;
my $include_args = "";
while($code =~ s/-include\s+(\S+)\s+//) {
$include_args .= "#include <$1> ";
}
my $args = "";
$args .= "$1 " while $code =~ s/^\s*(-[^ ]+)\s*//;
$args =~ s/\s+$//;
$code = "$include_args$code";
if($save_last_code) {
if($unshift_last_code) {
unshift @last_code, $extracted_args . (length $args ? $args . ' ' . $code : $code);
@ -1048,7 +1055,7 @@ if($output =~ m/^\s*$/) {
$output =~ s/<'(.*)' = char>/<'$1' = int>/g;
$output =~ s/= (-?\d+) ''/= $1/g;
$output =~ s/, <incomplete sequence >//g;
$output =~ s/\s*warning: shadowed declaration is here \[-Wshadow\]//g;
$output =~ s/\s*warning: shadowed declaration is here \[-Wshadow\]//g unless $got_paste or $got_run eq 'paste';
$output =~ s/preprocessor macro>\s+<at\s+>/preprocessor macro>/g;
$output =~ s/<No symbol table is loaded. Use the "file" command.>\s*//g;
$output =~ s/cc1: all warnings being treated as; errors//g;

View File

@ -8,7 +8,7 @@ my $USE_LOCAL = defined $ENV{'CC_LOCAL'};
my %languages = (
'C89' => {
'cmdline' => 'gcc $file $args -o prog -ggdb -g3',
'args' => '-Wextra -Wall -Wno-unused -std=gnu89 -lm -Wfatal-errors',
'args' => '-Wextra -Wall -Wno-unused -std=gnu89 -lm -Wfloat-equal -Wshadow -Wfatal-errors',
'file' => 'prog.c',
},
'C++' => {
@ -18,12 +18,12 @@ my %languages = (
},
'C99' => {
'cmdline' => 'gcc $file $args -o prog -ggdb -g3',
'args' => '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -std=c99 -lm -Wfatal-errors',
'args' => '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c99 -lm -Wfatal-errors',
'file' => 'prog.c',
},
'C11' => {
'cmdline' => 'gcc $file $args -o prog -ggdb -g3',
'args' => '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -std=c11 -lm -Wfatal-errors',
'args' => '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors',
'file' => 'prog.c',
},
);