Skip to content
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

meson: correctly set WIN32 in config.h #3660

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lazka
Copy link

@lazka lazka commented Oct 26, 2023

To match the autotools build.

To match the autotools build.
@lazka
Copy link
Author

lazka commented Oct 26, 2023

An alternative would be to replace all checks for WIN32 in the code with _WIN32, but there are lots of places..

@b4n
Copy link
Member

b4n commented Oct 29, 2023

An alternative would be to replace all checks for WIN32 in the code with _WIN32, but there are lots of places..

And they are in ctags code, so this would have to be fixed upstream.

Not tested, but looks OK.

@Biswa96
Copy link
Contributor

Biswa96 commented Apr 3, 2024

And they are in ctags code, so this would have to be fixed upstream.

I have created a pull request to fix it in upstream ctags repository.

@elextr
Copy link
Member

elextr commented Apr 3, 2024

Is _WIN32 set for cross builds? For Geany Windows builds are usually cross built on Linux.

@Biswa96
Copy link
Contributor

Biswa96 commented Apr 4, 2024

Is _WIN32 set for cross builds?

_WIN32 is set in compiler which targets Windows platform - no header or IDE is required. You can verify that using cc -dM -E - < /dev/null | grep WIN32 command.

@Biswa96
Copy link
Contributor

Biswa96 commented Apr 4, 2024

This underlying issue has been fixed in upstream ctags repository.

@elextr
Copy link
Member

elextr commented Apr 5, 2024

This underlying issue has been fixed in upstream ctags repository.

Ok, will get included when the ctags is next updated from upstream.

@eht16
Copy link
Member

eht16 commented Apr 14, 2024

Is _WIN32 set for cross builds?

_WIN32 is set in compiler which targets Windows platform - no header or IDE is required. You can verify that using cc -dM -E - < /dev/null | grep WIN32 command.

Yep, looks good.
This is in a Docker container running the image we use in CI for cross-compilation:

root@470e6364089b:/build# x86_64-w64-mingw32-gcc -dM -E - < /dev/null | grep WIN32
#define __WIN32__ 1
#define _WIN32 1
#define WIN32 1
#define __WIN32 1

And natively in MSYS2 on Windows:

$ cc -dM -E - < /dev/null | grep WIN32
137:#define __WIN32__ 1
183:#define _WIN32 1
301:#define WIN32 1
325:#define __WIN32 1

@eht16
Copy link
Member

eht16 commented Apr 14, 2024

Is there anything wrong with merging this?

Even if it would be cooler to not have to set the flag, as it is done by Autotools as well, it might be ok.

And if uctags is updated next time, we could try to remove it again.

@Biswa96
Copy link
Contributor

Biswa96 commented Apr 14, 2024

$ cc -dM -E - < /dev/null | grep WIN32
137:#define __WIN32__ 1
183:#define _WIN32 1
301:#define WIN32 1
325:#define __WIN32 1

Yes, gcc and clang both defines those macros which are not official or documented by Microsoft. Those are probably for compatibility with ancient code. Android has similar issue about ANDROID vs __ANDROID__ but the later one should be used according to documentation.

Meanwhile in Linux side 🤦

$ gcc -dM -E - < /dev/null | grep -i linux
#define __linux 1
#define __gnu_linux__ 1
#define linux 1
#define __linux__ 1

@@ -185,6 +185,10 @@ if python_command == '' or python_command == 'auto'
endif
cdata.set('PYTHON_COMMAND', python_command)

if host_machine.system() == 'windows'
Copy link
Member

Choose a reason for hiding this comment

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

This is fine, but we probably should stop using target_machine everywhere else…

Copy link
Member

@b4n b4n left a comment

Choose a reason for hiding this comment

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

LGTM as far as 0-testing goes

@b4n
Copy link
Member

b4n commented Apr 22, 2024

Is there anything wrong with merging this?

Even if it would be cooler to not have to set the flag, as it is done by Autotools as well, it might be ok.

And if uctags is updated next time, we could try to remove it again.

I don't see any reason not to merge this indeed, if it fixes something.

@eht16 eht16 added this to the 2.1 milestone Apr 30, 2024
eht16 added a commit to eht16/geany that referenced this pull request May 20, 2024
eht16 added a commit to eht16/geany that referenced this pull request May 20, 2024
@eht16
Copy link
Member

eht16 commented May 20, 2024

Since the changes in upstream ctags have been pulled into Geany already, the last use was in ctags/gnu_regex/regex_internal.h which is our code, if I'm not mistaken.

So, what do you think about #3878 to remove the WIN32 macro completely? CI and manual builds on Windows with Autotools and Meson succeeded.

@b4n
Copy link
Member

b4n commented May 20, 2024

@eht16 no, it's ctags, or rather glibc 2.10. Apparently though upstream ctags switched to gnulib's in universal-ctags/ctags#3054, so we might want to follow that… which might or might not solve this.

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.

None yet

5 participants