mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 13:59:47 +01:00
compiler_vm: add -Wshadow; support -include
This commit is contained in:
parent
c1fa37f982
commit
8e07eb300e
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 562,
|
BUILD_REVISION => 563,
|
||||||
BUILD_DATE => "2014-05-01",
|
BUILD_DATE => "2014-05-01",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ my $unshift_last_code = 0;
|
|||||||
my $only_show = 0;
|
my $only_show = 0;
|
||||||
|
|
||||||
my %languages = (
|
my %languages = (
|
||||||
'C11' => "gcc -std=c11 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -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 -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 -Wfatal-errors",
|
'C89' => "gcc -std=c89 -pedantic -Wall -Wextra -Wno-unused -Wfloat-equal -Wshadow -Wfatal-errors",
|
||||||
);
|
);
|
||||||
|
|
||||||
my %preludes = (
|
my %preludes = (
|
||||||
@ -637,10 +637,17 @@ $got_paste = 1 and $extracted_args .= "-paste " if $code =~ s/(?<=\s)*-paste\s*/
|
|||||||
my $got_nomain = undef;
|
my $got_nomain = undef;
|
||||||
$got_nomain = 1 and $extracted_args .= "-nomain " if $code =~ s/(?<=\s)*-nomain\s*//i;
|
$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 = "";
|
my $args = "";
|
||||||
$args .= "$1 " while $code =~ s/^\s*(-[^ ]+)\s*//;
|
$args .= "$1 " while $code =~ s/^\s*(-[^ ]+)\s*//;
|
||||||
$args =~ s/\s+$//;
|
$args =~ s/\s+$//;
|
||||||
|
|
||||||
|
$code = "$include_args$code";
|
||||||
|
|
||||||
if($save_last_code) {
|
if($save_last_code) {
|
||||||
if($unshift_last_code) {
|
if($unshift_last_code) {
|
||||||
unshift @last_code, $extracted_args . (length $args ? $args . ' ' . $code : $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/<'(.*)' = char>/<'$1' = int>/g;
|
||||||
$output =~ s/= (-?\d+) ''/= $1/g;
|
$output =~ s/= (-?\d+) ''/= $1/g;
|
||||||
$output =~ s/, <incomplete sequence >//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/preprocessor macro>\s+<at\s+>/preprocessor macro>/g;
|
||||||
$output =~ s/<No symbol table is loaded. Use the "file" command.>\s*//g;
|
$output =~ s/<No symbol table is loaded. Use the "file" command.>\s*//g;
|
||||||
$output =~ s/cc1: all warnings being treated as; errors//g;
|
$output =~ s/cc1: all warnings being treated as; errors//g;
|
||||||
|
@ -8,7 +8,7 @@ my $USE_LOCAL = defined $ENV{'CC_LOCAL'};
|
|||||||
my %languages = (
|
my %languages = (
|
||||||
'C89' => {
|
'C89' => {
|
||||||
'cmdline' => 'gcc $file $args -o prog -ggdb -g3',
|
'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',
|
'file' => 'prog.c',
|
||||||
},
|
},
|
||||||
'C++' => {
|
'C++' => {
|
||||||
@ -18,12 +18,12 @@ my %languages = (
|
|||||||
},
|
},
|
||||||
'C99' => {
|
'C99' => {
|
||||||
'cmdline' => 'gcc $file $args -o prog -ggdb -g3',
|
'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',
|
'file' => 'prog.c',
|
||||||
},
|
},
|
||||||
'C11' => {
|
'C11' => {
|
||||||
'cmdline' => 'gcc $file $args -o prog -ggdb -g3',
|
'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',
|
'file' => 'prog.c',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user