Skip to content

Control expensive assertion in Distribution.Solver.Modular.Linking with a build flag. - #4346

Merged
23Skidoo merged 6 commits into
haskell:masterfrom
sebright:expensive-assertions
Feb 21, 2017
Merged

23Skidoo merged 6 commits into
haskell:masterfrom
sebright:expensive-assertions

Conversation

@sebright

Copy link
Copy Markdown
Collaborator

I added a function, debugAssert, that wraps assert and only calls it when
the build flag debug-assertions is enabled. The flag defaults to false. I
only replaced one call to assert so far (in Distribution.Solver.Modular.Linking)
in order to resolve #4258.


I enabled debug-assertions in a new GHC 8.0.1 build job, because I figured that it is important to continue testing with the default flag settings in all of the other matrix entries. I could set -fdebug-assertions in one of the existing jobs instead, if it's not worth creating a separate job.

I can also make a PR for the 2.0 branch.

I added a function, 'debugAssert', that wraps 'assert' and only calls it when
the build flag 'debug-assertions' is enabled.  The flag defaults to false. I
only replaced one call to 'assert' so far (in Distribution.Solver.Modular.Linking)
in order to resolve haskell#4258.
@mention-bot

Copy link
Copy Markdown

@GrayJay, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edsko, @ezyang and @dcoutts to be potential reviewers.

Comment thread cabal-install/cabal-install.cabal Outdated
description: Get Network.URI from the network-uri package
default: True

Flag debug-assertions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshedding: what about introducing a flag assertions and call this one expensive-assertions to make it more clear what's going on? Then I guess debugAssert could be renamed to expensiveAssert. What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, given that we already have debug-tracetree, we could also have debug-assertions for ghc-options: -fno-ignore-asserts and debug-expensive-assertions for expensive ones.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the names debug-expensive-assertions and expensiveAssert. I think that it would be simpler to use ghc-options: -fno-ignore-asserts to enable the usual assertions in cabal.project, though, because we could set the same flag for all packages:

-- ghc-options: -fno-ignore-asserts

@23Skidoo

Copy link
Copy Markdown
Member

Everything looks good to me, merging.

@23Skidoo
23Skidoo merged commit e84a99a into haskell:master Feb 21, 2017
@23Skidoo

Copy link
Copy Markdown
Member

Merged, thanks!

@sebright

Copy link
Copy Markdown
Collaborator Author

Thanks!

@sebright
sebright deleted the expensive-assertions branch February 22, 2017 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expensive assertion in Distribution.Solver.Modular.Linking

3 participants