# HG changeset patch # User unc0rr # Date 1400176717 -14400 # Node ID 3ccc054c3c3e6c0ed94946f23e2e1074c01d8741 # Parent f7b5b4b881719bb7d6b9b31bb9d40cc5320043d0 Fix some pas2c engine warnings diff -r f7b5b4b88171 -r 3ccc054c3c3e hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Wed May 14 22:50:07 2014 +0400 +++ b/hedgewars/uGearsUtils.pas Thu May 15 21:58:37 2014 +0400 @@ -380,7 +380,7 @@ Gear^.dY:= _90-(GetRandomf*_360) end else DeleteGear(Gear); - exit + exit(true) end; isSubmersible:= ((Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.State and gstSubmersible <> 0)) or (Gear^.State and gstSubmersible <> 0); skipSpeed := _0_25; @@ -414,7 +414,7 @@ begin // Gear could become nil after this, just exit to skip splashes ResurrectHedgehog(Gear); - exit + exit(true) end else begin @@ -427,7 +427,7 @@ else Gear^.doStep := @doStepDrowningGear; if Gear^.Kind = gtFlake then - exit // skip splashes + exit(true) // skip splashes end else if (Y > cWaterLine + cVisibleWater*4) and ((Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.State and gstSubmersible = 0)) then diff -r f7b5b4b88171 -r 3ccc054c3c3e tools/pas2c/Pas2C.hs --- a/tools/pas2c/Pas2C.hs Wed May 14 22:50:07 2014 +0400 +++ b/tools/pas2c/Pas2C.hs Thu May 15 21:58:37 2014 +0400 @@ -15,7 +15,7 @@ import Data.List (find) import Numeric -import PascalParser(pascalUnit) +import PascalParser import PascalUnitSyntaxTree @@ -237,7 +237,11 @@ pascal2C (Program _ implementation mainFunction) = do impl <- implementation2C implementation - [main] <- tvar2C True False True True (FunctionDeclaration (Identifier "main" (BTInt True)) False False False (SimpleType $ Identifier "int" (BTInt True)) [VarDeclaration False False ([Identifier "argc" (BTInt True)], SimpleType (Identifier "Integer" (BTInt True))) Nothing, VarDeclaration False False ([Identifier "argv" BTUnknown], SimpleType (Identifier "PPChar" BTUnknown)) Nothing] (Just (TypesAndVars [], mainFunction))) + [main] <- tvar2C True False True True + (FunctionDeclaration (Identifier "main" (BTInt True)) False False False (SimpleType $ Identifier "int" (BTInt True)) + [VarDeclaration False False ([Identifier "argc" (BTInt True)], SimpleType (Identifier "Integer" (BTInt True))) Nothing + , VarDeclaration False False ([Identifier "argv" BTUnknown], SimpleType (Identifier "PPChar" BTUnknown)) Nothing] + (Just (TypesAndVars [], Phrases [mainResultInit, mainFunction]))) return $ impl $+$ main diff -r f7b5b4b88171 -r 3ccc054c3c3e tools/pas2c/PascalParser.hs --- a/tools/pas2c/PascalParser.hs Wed May 14 22:50:07 2014 +0400 +++ b/tools/pas2c/PascalParser.hs Thu May 15 21:58:37 2014 +0400 @@ -1,5 +1,6 @@ module PascalParser ( - pascalUnit + pascalUnit, + mainResultInit ) where @@ -13,6 +14,10 @@ import PascalBasics import PascalUnitSyntaxTree + +mainResultInit :: Phrase +mainResultInit = (\(Right a) -> a) $ parse phrase "" "main:= 0;" + knownTypes :: [String] knownTypes = ["shortstring", "ansistring", "char", "byte"]