msys2 / msys2.github.io

The MSYS2 homepage
https://www.msys2.org
Other
2.35k stars 305 forks source link

In all environment, no "__LLP64__" macro #349

Open SSDGADsss opened 2 weeks ago

SSDGADsss commented 2 weeks ago

When I compile VLFeat library, I compiled under CLANG64 and UCRT64, and I noticed that the compiled program data type is 32-bit. When I checked the code, I found that neither the clang nor mingw64 compilers pre-defined the __LLP64__ macro. This is a question about msys2 or the compiler, but I have tried all environments without defining this macro. This may be a problem, can anyone help me?

This is a test file I wrote to reproduce the issue

#include <iostream>

int main()
{
#ifdef __LLP64__
std::cout<<"LLP64"<<std::endl;
#endif
#ifdef __LP64__
std::cout<<"LP64"<<std::endl;
#endif
return 0;
}

This program has no output under clang64 and ucrt64 in msys2.

May I ask if anyone can provide assistance? I am happy to solve this problem and contribute to the project.

lazka commented 2 weeks ago

Where is __LLP64__ documented? I can't find anything specific.

SSDGADsss commented 2 weeks ago

Sorry, I couldn't find a macro definition for "LLP64" online, but I saw it in some ancient code, which may be my problem. However, the macro definition for "LP64" is mentioned in the GCC documentation, and I think Mingw or Clang compilers should also have such macro definitions

GCC Document

I use Compiler Explorer check "LP64" macro is define on clang and gcc . but I don't know why this macro is not appear on msys environment.

lazka commented 2 weeks ago

Since both target Windows where "long int" is 32 bit and not 64 bit __LP64__ should not be defined.

It is defined in our cygwin env though (/usr/bin/gcc)