Skip to content

Commit

Permalink
Fix order of programArgs parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jgotoh committed Aug 24, 2024
1 parent 0bcb7d4 commit fceeb15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cabal-install/parser-tests/Tests/ParserTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,11 @@ testAllPackagesConcat = do
mempty
{ packageConfigSharedLib = Flag True
, packageConfigStaticLib = Flag True
, packageConfigProgramArgs = MapMappend $ Map.fromList [("ghc", ["-fwarn-tabs", "-Wall"])]
, packageConfigProgramArgs =
MapMappend $
Map.fromList
[ ("ghc", ["-fwarn-tabs", "-optc-fno-builtin-malloc", "-Wall", "-optc-fno-builtin-realloc", "-fwrite-ide-info"])
]
}

testSpecificPackagesConcat :: Assertion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package *
static: True
ghc-options: -Wall
ghc-options: -fwrite-ide-info
ghc-options: -Wall -optc-fno-builtin-realloc

package *
shared: True
ghc-options: -fwarn-tabs
ghc-options: -fwarn-tabs -optc-fno-builtin-malloc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ parseProgramArgs programDb fields = foldM parseField mempty (filter hasOptionsSu
case readProgramName "-options" programDb fieldName of
Nothing -> warnUnknownFields fieldName fieldLines >> return programArgs
Just program -> do
args <- parseProgramArgsField fieldLines
args <- parseProgramArgsField $ reverse fieldLines
return $ programArgs <> MapMappend (Map.singleton program args)
hasOptionsSuffix (fieldName, _) = BS.isSuffixOf "-options" fieldName

Expand Down

0 comments on commit fceeb15

Please sign in to comment.