-
Notifications
You must be signed in to change notification settings - Fork 7
Fix some errors and warning when compiling with visual studio. #10
Conversation
Howdy! Thanks for putting this together, let me take a look. Offhand the only piece I find a little controversial is the third commit, maybe you could explain the problem there in more detail? I notice also that the infrastructure in this repo is looking a little 2010. I'm going to get it wired up with some virtualization support and build services (including one for windows) before doing anything else. Once that lands (probably later today) hopefully you won't mind rebasing. |
In that 3rd patch that test was failing because the mock allocator function for Herbie was being called before the chasis or engine functions. My thought was that the order really doesn't matter as long as Herbie ends up with the correct CoupChasis and Hybrid engine which is already verified with the other asserts in that test. |
Looks like you've been busy and taken care of a couple of these! Do you still want me to rebase any of these patches? On another topic, have you ever considered trying to add something like the assisted inject feature guice has? It would be nice to have for a project I'm working on and was thinking about trying to add it. I wondered if you had any ideas about it? Thanks for the great library! |
Yea, getting modern clang happy for OS X seems to have led me to the same spots. I believe I also fixed the underlying issue requiring you to change the test in the 3rd commit: see if the current master works cleanly for you with MSVC. |
You asked about assisted injection; I hadn't really thought about it, but if the feature fits cleanly into a header-only library that deliberately does no code generation, then groovy ^_^. |
I pulled in your changes and msvc doesn't like them at all. :) I get a bunch of these compile errors error C2951: template declarations are only permitted at global, namespace, or class scope It looks like it has something to do with your changes to apply_variadic, don't have time to look at it at the moment though. |
Ok. I'm also trying to get appveyor happy, which is a build service that offers (my only) access to MSVC. Hopefully whatever you're bumping into will fall out from that. |
Yea, appveyor is giving me something similar. Are these the errors you see? https://ci.appveyor.com/project/phs/sauce/build/1.0.64/job/lw97bsblqtq6l844 |
Those errors from appveyor are what I was seeing. I reverted the changed that caused that to work on the allocate_shared patch I commited and after that patch I'm not seeing the unit test failure any more. I might have misunderstood what the original failure was. Take a look and see what you think. |
The original failure was the fact that the dependencies were being injected (constructed) after the thing they are injected into. That seems counter-intuitive, but there it is. The core issue was my choice in Anyway, I extracted the sub-expressions to locals to force a "sequence point" in pre-C++11 lingo. Then all the dependent side-effects (including observation by my mocks) would complete before the dependent call was ever made. On the way I extracted some typedefs to make the template magic easier on the eyes. I don't know yet but I guess this may be where I made MSVC angry (though my typedef is not a template, and indeed the other two compilers vouch that there are no templates within functions.) |
|
We've seen the make/allocate _shared functions have some pretty significant performance improvements in certain scenarios. Based on the failing builds it looks like tr1 didn't have allocate_shared though. I'm also not sure if I picked the correct boost header, trying to do it from memory. I can verify that tomorow. |
Well boo. Pretty sure this is us (and a few spots in gmock as well): https://support.microsoft.com/en-us/kb/241940 EDIT: Hm, maybe. It's not clear if it's a match or not, but there are certainly bugs in modern MSVC that involve spuriously reporting this error. |
Wait. All the |
With the 849c9c7 patch included I'm not getting any warnings at all. It looks like all the warnings from that appveyor output is just due to the fact that the /EHsc compiler flag wasn't enabled. I do have that enabled in my project. |
Interesting. On the linked appveyor build (such as here) I'm seeing lots of |
Surely you don't mean the latest appveyor build for this PR, which errored out due to basic config not being set. |
Maybe I misread your other comment. I'm seeing all of those C2951 errors when building master, essentially the same thing appveyor was reporting. I'm not seeing any compiler warnings though. To get everything working locally I reverted your last change to apply_variadic and used the 3 patches in this pull request. Then I had no errors or warnings. |
Ok, that makes more sense. I'll revert the latest master commit & get the appveyor config merged so we can prove that appveyor will do what you're seeing locally. Then I'd like to try other variations of the reverted commit, since I do believe the current behavior allows the compiler to introduce subtle bugs. |
Ok, offending commit reverted & appveyor config merged. Try rebasing now. |
Hello! Since you're still out I'm tempted to pull in just your first two commits in a new PR, in an effort to get MSVC happy (& not cheat you out of the authorship.) I'm open to working more on integrating |
Yup that seems like a smart approach. I can push a new patch here in a minute. |
Groovy, that's looking pretty good. The linker problem probably just needs me to pass Let me see if I can make the appveyor config happy with this and the needed |
The missing flags appear to be in & working now, feel free to rebase. |
This addresses the issue reported in #5.
Your commits appear in #20 |
This pull request fixes some issues when compiling with visual studio, including #5.