3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

Rename -naked to -nomain; fix issue with function prototypes

This commit is contained in:
Pragmatic Software 2012-12-30 08:14:27 +00:00
parent 9205736b3f
commit e846f24716
2 changed files with 6 additions and 6 deletions

View File

@ -13,8 +13,8 @@ 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 => 399, BUILD_REVISION => 400,
BUILD_DATE => "2012-12-29", BUILD_DATE => "2012-12-30",
}; };
1; 1;

View File

@ -156,8 +156,8 @@ $input = $1 if $code =~ s/-(?:input|stdin)=(.*)$//i;
my $got_paste = undef; my $got_paste = undef;
$got_paste = 1 if $code =~ s/\s*-paste\s*//i; $got_paste = 1 if $code =~ s/\s*-paste\s*//i;
my $got_naked = undef; my $got_nomain = undef;
$got_naked = 1 if $code =~ s/\s*-naked\s*//i; $got_nomain = 1 if $code =~ s/\s*-nomain\s*//i;
my $args = ""; my $args = "";
$args .= "$1 " while $code =~ s/^\s*(-[^ ]+)\s*//; $args .= "$1 " while $code =~ s/^\s*(-[^ ]+)\s*//;
@ -764,7 +764,7 @@ if($lang eq 'C89' or $lang eq 'C99' or $lang eq 'C11' or $lang eq 'C++') {
print "looking for functions, has main: $has_main\n" if $debug >= 2; print "looking for functions, has main: $has_main\n" if $debug >= 2;
my $func_regex = qr/^([ *\w]+)\s+([*\w]+)\s*\((.*?)\s*\)\s*({.*)/ims; my $func_regex = qr/^([ *\w]+)\s+([*\w]+)\s*\(([^;]+)\s*\)\s*({.*)/ims;
# look for potential functions to extract # look for potential functions to extract
while($preprecode =~ /$func_regex/ms) { while($preprecode =~ /$func_regex/ms) {
@ -823,7 +823,7 @@ if($lang eq 'C89' or $lang eq 'C99' or $lang eq 'C11' or $lang eq 'C++') {
$precode =~ s/^{(.*)}$/$1/s; $precode =~ s/^{(.*)}$/$1/s;
if(not $has_main and not $got_naked) { if(not $has_main and not $got_nomain) {
$code = "$prelude\n\n$code\n\nint main(void) {\n$precode\n;\nreturn 0;\n}\n"; $code = "$prelude\n\n$code\n\nint main(void) {\n$precode\n;\nreturn 0;\n}\n";
$nooutput = "No warnings, errors or output."; $nooutput = "No warnings, errors or output.";
} else { } else {