Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Conversation

@MartinNowak
Copy link
Member

  • fix parsing of existing .lst file
  • use append semantics (create or merge with existing .lst file)
  • enable merge by default
  • some code cleanup (reuse buffers, log10, foreach, min/max)

Issue 14464 – coverage merge doesn't work

@MartinNowak
Copy link
Member Author

Added a commit to perform race free updates of coverage files.

@MartinNowak MartinNowak force-pushed the fix14464 branch 17 times, most recently from f186d4d to 9cdb8c9 Compare April 27, 2015 01:29
@MartinNowak
Copy link
Member Author

Race free merging of coverage files finally works on all platforms.

@WalterBright
Copy link
Member

Looks great, but I'm a bit perturbed by the automatic merging. My usage is along the lines of:

dmd std/file -main -unittest -cov
file
look at std-file.lst

and your change would make it:

dmd std/file -main -unittest -cov
rm std-file.lst
file
look at std-file.lst

which is annoying.

@MartinNowak
Copy link
Member Author

Let me quickly move the coverage settings to core.runtime, then it's less annoying to turn merging on.

@MartinNowak
Copy link
Member Author

Done.
It's still a bit surprising to have merging off by default, because other tools like gcov, gprof, and even dmd's -prof do merge by default.

@MartinNowak
Copy link
Member Author

Ping @WalterBright

@MartinNowak MartinNowak added this to the 2.068 milestone May 15, 2015
@MartinNowak
Copy link
Member Author

3 weeks already, anyone?

Copy link
Member

Choose a reason for hiding this comment

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

What's the point of these trivial wrappers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Documenting the functionality.
Some extern C functions buried in the runtime don't qualify as API.

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this justification at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

???
Nobody knows that coverage generation can be configured.
If there are function that allow to change the behavior, we need to make them accessible and document them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you're wondering why I didn't just document the declarations for dmd_coverSourcePath?
Well b/c they have arcane names that don't fit into the rest of core.runtime's API, and I wanted to preserve the extern(C) names, in case someone is already using that functions.
I don't really like the namespacing Runtime struct either, but mixing different styles is worse.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I was wondering why. Thanks for the explanation. But I don't think it justifies creating yet more names. I really, really do not want Phobos/Druntime to become a bloated swamp of same-only-different names. We've been through this discussion of "arcane" names before, and the pros and cons of endless renamings. Let's stop doing it.

- fix parsing of existing .lst file
- use append semantics (create or merge with existing .lst file)
- enable merge by default
- some code cleanup (reuse buffers, log10, foreach, min/max)
@MartinNowak
Copy link
Member Author

Anything left @WalterBright?

@andralex
Copy link
Member

@MartinNowak please do not add do-nothing one-liners that forward from Annas to Caiaphas. There are a few odd names in druntime, but no need to add yet another layer on top of those. Let's leave them be. Getting the right recommendations fostered for the larger set of contributors must start with the leadership observing them. Thanks.

@dnadlinger
Copy link
Contributor

@andralex: I agree, but I think this point is irrelevant here. dmd_coverSourcePath et al. are currently not public API. Quick litmus test: Can you actually document them in a way visible to users? Or rather, how would a user know that these functions even exist from reading the druntime docs?

The functions discussed here are in rt.*, and as such can only be accessed from user code by manually defining a matching extern(C) declaration. There is a multitude of problems with that situation. First, forcing users to redeclare extern(C) functions in their code is error-prone; if there is a typo, there will be a silent ABI mismatch. Second, the existing names are odd. LDC now also implements a DMD-style -cov switch. dmd_* does not seem appropriate here. And third, as mentioned above, rt.* is private to druntime (at least for LDC, we don't even ship .d/.di files to users), so we are completely unable to document them.

@ibuclaw
Copy link
Member

ibuclaw commented May 21, 2015

Exposing this in core.runtime is odd for me, as I don't use dmd-style coverage at all. And from my cursory look around, gcov doesn't offer any such equivalents to be set at runtime either.

@WalterBright
Copy link
Member

  1. We are NOT renaming functions any more. I've given the reasons why, at length, in a dozen threads. Please accept this and let's move on.
  2. Defining such wrappers of module Y functions in module X means that linking in something from X will also pull in Y.
  3. To make the extern (C) declaration of a Y function available from X, add this to X:
extern (C) T theYfunction();

The trailing ; means it is a declaration, not a definition. A wrapper is not required.

@dnadlinger
Copy link
Contributor

Okay, I'll do nothing but smile and move on. Move on from D.

@dnadlinger
Copy link
Contributor

@ibuclaw: You have a point there, although the functions could certainly be versioned off. Maybe a different module would be better? Or stick with with the "hidden" functions despite all their shortcomings, but then we'd need to make up for that with much better documentation than usual.

@MartinNowak
Copy link
Member Author

What's all the discussion about? There are 3 internal functions that need to be documented and made available for usage and it just makes sense to do that in the same form as the rest of the core.runtime API.

@MartinNowak
Copy link
Member Author

Exposing this in core.runtime is odd for me, as I don't use dmd-style coverage at all. And from my cursory look around, gcov doesn't offer any such equivalents to be set at runtime either.

So any suggestion on how to deal with this @ibuclaw? Apparently we need the same settings for LDC. Maybe add assertions or better make them noops?

@MartinNowak
Copy link
Member Author

We are NOT renaming functions any more. I've given the reasons why, at length, in a dozen threads. Please accept this and let's move on.

Those functions arent't currently exposed and I still explicitly did not rename them, not sure why you're making that argument.

Defining such wrappers of module Y functions in module X means that linking in something from X will also pull in Y.

That's not true for our static libraries (we only link used functions) and dynamic libraries (they contain all code). We could also use an alias, but that's worse for documentation.

It is simply an API decision, and as the GDC/LDC discussion shows extern(C) dmd_coverSetMerge is not adequate.

@ibuclaw
Copy link
Member

ibuclaw commented May 22, 2015

@MartinNowak maybe __traits(compiles, dmd_coverSetMerge) - I'm not one with answers on how to deal with internal APIs, just pointing out what breaks code convergence. ;-)

@WalterBright
Copy link
Member

Please, take the wrappers out.

@MartinNowak
Copy link
Member Author

Done

@WalterBright
Copy link
Member

Thanks!

@WalterBright
Copy link
Member

Auto-merge toggled on

WalterBright added a commit that referenced this pull request May 25, 2015
fix Issue 14464 - coverage merge doesn't work
@WalterBright WalterBright merged commit 789f02e into dlang:master May 25, 2015
@MartinNowak MartinNowak deleted the fix14464 branch May 27, 2015 14:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants