-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check Type::Native in isWindows() (f'up to #11917) #5458
base: main
Are you sure you want to change the base?
Conversation
What does this fix? Why no tests? |
See #5428 |
Platform is actually representing the compiler and not an operating system. So there are differences between running on Windows, using the Windows APIs and using Microsoft compiler extensions. So that might be a bandaid for only part of things. So the platforms should actually be called something like This is basically best case scenario. I have several steps in that direction but as usual it's all too entangled and then we also have built-in platforms which make things more difficult. I won't be able to get into this until tomorrow or even Wednesday. |
After upgrading to head, I started getting lots of |
Okay, that was the information I was lacking. 👍 I am fine with having this change in for now, but let please me have a look first. |
Okay, I had a look. The functions check for the Windows platform to do Windows API adjustments but call it "Microsoft" which is semantically misleading ( There's also some other ansi/unicode handling mapping in the code. This should actually be in the configuration ( Having ANSI/Unicode in the platform is quite unfortunately and completely misleading as it is not a global switch in the compiler but part of the Windows API/headers actually controlled by the So we should do the following:
I will file tickets about this and check my countless platform-related branches/PRs for more things. For now this hack should be fine as but we should start this during this development cycle as the migration will probably drag on. |
FYI: The _T macro from wxwidgets is defined here: https://docs.wxwidgets.org/3.0/group__group__funcmacro__string.html |
@@ -181,6 +182,16 @@ class TestPlatform : public TestFixture { | |||
ASSERT_EQUALS(64, platform.long_long_bit); | |||
} | |||
|
|||
void valid_config_native() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also please add a test for the actual issue you encountered? That would make it much clearer what is intended here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should first decide whether _T()
etc. are tied to a platform or a library. Then we can test if it is properly replaced. Btw, there are more calls to isWindows()
which are also affected with native
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is neither. It is tied to a user(!) defined macro.
It needs to be put into a library though as it comes from the API/headers and not the compiler.
We need to review all code but for now it should be fine to make the proposed change. That's why we have a development cycle so we are allowed to break things temporarily. And it is also why I did it immediately at the beginning of it so we have the time we need. For now I would just like to see a test for the actual problem you encountered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that we even have platform-dependent types in windows.cfg (e.g. TCHAR
).
Wrongly defined though (there is no check for |
As I see it currently no code on our side is doing it correctly. So no harm done. 😉 |
@@ -270,6 +271,16 @@ class TestSimplifyTokens : public TestFixture { | |||
ASSERT_EQUALS(expected, tokenizer.tokens()->stringifyList(nullptr, false)); | |||
} | |||
|
|||
void combine_wstrings_Windows() { | |||
#if defined(_WIN32) && defined(UNICODE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That check doesn't seem to make sense. It should default to ANSI if just isWindows()
is true. So we should test native on Windows and not Windows (with _WIN32
check) and also test the win32A
and win32W
platforms.
And I just realized that we only have win64
. I guess that is used more than the 32-bit so there is no way to actually configure the Unicode versions for 64-bit Windows scans and the two win32
platform make even less sense and we could just deprecate those without doing any other changes whatsoever. This is such a mess...😪😶😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
So will we be dropping support for anything but 64bit + UNICODE?
It's also kind of silly that we accept two unknown macros in a row (return _T(...) _T(...);
), but throw an error for the third.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So will we be dropping support for anything but 64bit + UNICODE?
At least I will try to deprecate certain things and make them more generic. But I have already been doing that in a very iterative way for quite a while now. There' just two many things which are entangled and you need to wrap your head around.
The built-in platforms are a major pain as they spill into the GUI which makes things even more complicated as they are.
Now 2.14 has been released, and the issue is still present (an explicit platform must be passed to handle e.g. |
Yeah, I dropped the ball on this, sorry. Just too many things. I hope to take a look soon. |
No description provided.