d63b05
authorDebian Games Team <pkg-games-devel@lists.alioth.debian.org>
Fri, 5 Aug 2022 15:21:55 +0000 (16:21 +0100)
committerGianfranco Costamagna <locutusofborg@debian.org>
Fri, 5 Aug 2022 15:21:55 +0000 (16:21 +0100)
# HG changeset patch
# User unc0rr
# Date 1603217384 -7200
# Node ID 036263d63b05e954624444d32c5116c2329bce80
# Parent  82fd124e6512b0a89162ae984ff908306455703f
Fix lack of declaration decorations for dynamic arrays in Pas2C

Gbp-Pq: Name 036263d63b05.patch

tools/pas2c/Pas2C.hs

index 8aaf6c13e79dab763e1d25d6956304d68c28cc2f..36e079c152c0f3afa84d2eddb40e2b47b3d405a5 100644 (file)
@@ -574,10 +574,7 @@ tvar2C _ _ _ _ (VarDeclaration True _ (ids, t) Nothing) = do
     liftM (map(\i -> t' i)) $ mapM (id2CTyped2 (Just $ t' empty) (VarParamType t)) ids
 
 tvar2C _ externVar includeType ignoreInit (VarDeclaration _ isConst (ids, t) mInitExpr) = do
-    t' <- liftM (((if isConst then text "static const" else if externVar
-                                                                then text "extern"
-                                                                else empty)
-                   <+>) . ) $ type2C t
+    t' <- liftM ((declDetails <+>) . ) $ type2C t
     ie <- initExpr mInitExpr
     lt <- gets lastType
     case (isConst, lt, ids, mInitExpr) of
@@ -602,12 +599,15 @@ tvar2C _ externVar includeType ignoreInit (VarDeclaration _ isConst (ids, t) mIn
                     where
                         arrayDimStr = show $ arrayDimension t
                         arrayDimInitExp = text ("={" ++ ".dim = " ++ arrayDimStr ++ ", .a = {0, 0, 0, 0}}")
-                        dimDecl = varDeclDecision isConst includeType (text "fpcrtl_dimension_t" <+>  i' <> text "_dimension_info") arrayDimInitExp
+                        dimDecl = varDeclDecision isConst includeType (declDetails <+> text "fpcrtl_dimension_t" <+>  i' <> text "_dimension_info") arrayDimInitExp
 
                 (_, _) -> return result
 
          _ -> liftM (map(\i -> varDeclDecision isConst includeType (t' i) ie)) $ mapM (id2CTyped2 (Just $ t' empty) t) ids
     where
+    declDetails = if isConst then text "static const" else if externVar
+                                                            then text "extern"
+                                                            else empty
     initExpr Nothing = return $ empty
     initExpr (Just e) = liftM (text "=" <+>) (initExpr2C e)
     varDeclDecision True True varStr expStr = varStr <+> expStr