fix sclang unity builds in msvc#7489
Conversation
|
So I have a concern about unity builds based on your explanation. Right now, I find it a common occurrence to have different compilers, build systems and os behave differently. This can be due to GCC and clang not agreeing, or more commonly msvc strictly adhering to the standard, sometimes it's due to different oss and the system libraries... Many reasons. I am a bit concerned that this will add yet another way that the code will work on my machine (doing incremental compilation) and not on the ci, as debugging based on GitHub's output is not a pleasant experience! |
|
These are valid concerns! Yet another configuration that may behave differently is definitely something to be weary of. FWIW I don't suggest that we move all CI to a unity build... but if it is significantly faster, we could move most of CI, and leave one non-unity build for testing. I think it is worth discussing before we move this further. @jrsurge do you have any suggestions here? Adding another build configuration that may behave slightly differently is a concern and we don't want to create more maintenance burden. |
It sounds like you want to run this as an experiment? It that case, since reverting something in the build system is so easy, I say just do it and see what happens! No need to discuss something we don't have enough information about yet! Fyi, the enum conflict is due to a namespace issue, if you add The problems with the yy* vars seems real though, the bison generator makes a tone of globals, we have two grammars, sclang and the docs, I believe this necessitates odr violations?? |
|
Thanks!
Hm, are you sure? The issue is that our definition leaks into Windows headers, IIUC, e.g.: As for the macro conflicts, do you think they should be solved in the code (pop/push macro) or is it fine to just exclude these files from the unity build like I'm proposing right now? |
Ah yes I'm still not 100% sure how they work. Assuming it's the TokenType from the new lexer, then it's in a namespace so can't collide (unless they also have a I've only ever used undef with macros, but it's with a go? What I'm concerned about is constantly adding to this list. We should try to get everything working correctly first... but if you just wanna see what happens and if it affects development then I'm also fine with merging now! |
Do you mean - unity build working correctly by excluding files? Or fixing files so that they we don't populate conflicting names/macros into windows headers? |
|
Fixing the files |
Purpose and Motivation
This PR fixes unity build for sclang under MSVC.
This was achieved by excluding files from the unity build. The need to exclude multiple files comes from naming/macro clashes with Windows headers, AFAIU
Additionally, I've turned on unity build for a single non-release build on each platform.
I plan to fix unity builds for other components, and once that is done, we can decide if we want to use unity builds by default or not.
Types of changes
To-do list