Fixed handling of cdecl fixups with 0 arguments.
authorshort <>
Fri, 4 Jul 2003 04:18:33 +0000 (04:18 +0000)
committershort <>
Fri, 4 Jul 2003 04:18:33 +0000 (04:18 +0000)
src/libcaptive/ke/captivesym.pl

index 16d5c31..c68fc3f 100755 (executable)
@@ -40,7 +40,7 @@ while ($ARGV[0] && $ARGV[0]=~/[.]def$/) {
                die "Invalid attributes for data symbol: $symbol" if $isdata && ($atsign || defined $args);
                die "\@funcname without \@4 suffix not recognized: $symbol" if $atsign && !defined $args;
                die "Invalid \@$args number: $symbol" if defined $args && ($args<0 || ($args%4));
-               if (!$argscdecl) {
+               if (!defined $argscdecl) {      # beware: $argscdecl may eq "0"
                        die "Duplicate symbol: $symbol" if exists $def{$symbol};
                        }
                else {
@@ -50,7 +50,7 @@ while ($ARGV[0] && $ARGV[0]=~/[.]def$/) {
                        $args=$argscdecl;
                        }
                $def{$symbol}={
-                               "type"=>($isdata ? "data" : (!defined $args ? "cdecl" : (!$atsign ? "stdcall" : "fastcall"))),
+                               "type"=>($isdata ? "data" : (!defined($args) || defined($argscdecl) ? "cdecl" : (!$atsign ? "stdcall" : "fastcall"))),
                                (!defined $args ? () : ("args4"=>$args/4)),
                                };
                }
@@ -84,7 +84,7 @@ while (<>) {
        die "Symbol not in *.def files: $symbol" if $iswhat ne "undef" && !$def{$symbol};
        if ($iswhat eq "pass" || $iswhat eq "wrap") {
                die "args count not fixed up for '$iswhat' type: ".$symbol."[".$def{$symbol}{"type"}."]"
-                               if !$def{$symbol}{"args4"} && $def{$symbol}{"type"} ne "data";
+                               if !exists $def{$symbol}{"args4"} && $def{$symbol}{"type"} ne "data";   # beware: {"args"} may ==0
                die "'$iswhat' not permitted if <patch> not specified for module on symbol: $symbol" if !$patch{$module};
                $def{$symbol}{$iswhat}=1;
                }