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

clang doesn't make the difference between UL & ULL sufixes #32

Closed
bog-dan-ro opened this issue Mar 21, 2016 · 11 comments
Closed

clang doesn't make the difference between UL & ULL sufixes #32

bog-dan-ro opened this issue Mar 21, 2016 · 11 comments

Comments

@bog-dan-ro
Copy link

thread/qthread.h:108:36: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 18446744073709551615 to
4294967295 [-Werror,-Wconstant-conversion]
bool wait(unsigned long time = ULONG_MAX);
~ ^~~~~~~~~
/home/bogdan/necessitas/android-ndk/platforms/android-9/arch-arm/usr/include/sys/limits.h:72:20: note: expanded from macro 'ULONG_MAX'

define ULONG_MAX 0xffffffffffffffffUL

                    ^~~~~~~~~~~~~~~~~~~~

Full command line:
/home/bogdan/necessitas/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -target armv7-none-linux-androideabi -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -D__LP64__ --sysroot=/home/bogdan/necessitas/android-ndk/platforms/android-9/arch-arm/ -g -Os -fomit-frame-pointer -fno-strict-aliasing -mthumb -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wdate-time -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_USING_NAMESPACE -DQT_HAVE_POLL -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_DEBUG -Wall -Wextra -Werror -Woverloaded-virtual -Wshadow -Wundef -Wnon-virtual-dtor -Wpointer-arith -Wformat-security -Wno-long-long -Wno-variadic-macros -pedantic-errors -Wchar-subscripts -Wold-style-cast -I. -I/home/bogdan/work/qt/openssl-1.0.2f/include -Iglobal -I../3rdparty/pcre -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty/double-conversion/include -I../3rdparty/double-conversion/include/double-conversion -I../3rdparty/forkfd -I../../include -I../../include/QtCore -I../../include/QtCore/5.7.0 -I../../include/QtCore/5.7.0/QtCore -I.moc -isystem /home/bogdan/necessitas/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/bogdan/necessitas/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/bogdan/necessitas/android-ndk/platforms/android-9/arch-arm/usr/include -I../../mkspecs/android-clang -DQT_NO_CAST_TO_ASCII=1 -DQT_NO_CAST_FROM_ASCII=1 -DQT_STRICT_ITERATORS -DQT_NO_URL_CAST_FROM_STRING=1 -DQT_NO_CAST_FROM_BYTEARRAY=1 -DQT_NO_KEYWORDS=1 -DQT_USE_QSTRINGBUILDER -DQT_USE_FAST_OPERATOR_PLUS -Dsignals=int -Dslots=int -Demit=public: -Dforeach=public: -Dforever=public: -xc++ thread/qthread.h -o .obj/header_qthread.o
thread/qthread.h:108:36: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 18446744073709551615 to
4294967295 [-Werror,-Wconstant-conversion]
bool wait(unsigned long time = ULONG_MAX);
~ ^~~~~~~~~
/home/bogdan/necessitas/android-ndk/platforms/android-9/arch-arm/usr/include/sys/limits.h:72:20: note: expanded from macro 'ULONG_MAX'

define ULONG_MAX 0xffffffffffffffffUL

                    ^~~~~~~~~~~~~~~~~~~~

1 error generated.

@bog-dan-ro
Copy link
Author

Ah, is -D__LP64__ fault, sorry for the noise!

@bog-dan-ro
Copy link
Author

Actually I still think it is a problem, xxxxUL should be unsigned long no matter what

@bog-dan-ro bog-dan-ro reopened this Mar 21, 2016
@DanAlbert
Copy link
Member

You'd think so, but the standard has other ideas: http://en.cppreference.com/w/cpp/language/integer_literal#The_type_of_the_literal

The L suffix means "at least long", but if the literal is large enough it can still promote to long long.

@DanAlbert
Copy link
Member

What is really weird is that you're getting the LP64 definition of ULONG_MAX for armeabi-v7a. I can't manage to make that happen with my test case. That definition is guarded by #ifdef __LP64__.

@bog-dan-ro
Copy link
Author

I added manually -D__LP64__ to command line, because with clang failed to cast

GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (
    GLenum target, GLint level, GLint xoffset, GLint yoffset,
    GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);

to

void (*CompressedTexSubImage2D)(
    GLenum target, GLint level, GLint xoffset, GLint yoffset,
    GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
opengl/qopengltexturehelper.cpp:160:29: error: assigning to 'void (*)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)' (aka 'void (*)(unsigned int, int, int, int, int, int, unsigned int, int, const void *)') from incompatible type 'void (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) __attribute__((pcs("aapcs")))' (aka 'void (unsigned int, int, int, int, int, int, unsigned int, int, const void *) __attribute__((pcs("aapcs")))')
CompressedTexSubImage2D = ::glCompressedTexSubImage2D;
                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

@DanAlbert
Copy link
Member

If you manually add -D__LP64__ on a 32-bit system, you're gonna have a bad time. A really, really bad time.

Looks like the incompatibility in the case is just the __attribute__((aapcs))? Are you using armeabi-v7a-hard?

I think the problem here is that you need:

-void (*CompressedTexSubImage2D)(
+GL_APICALL void (*CompressedTexSubImage2D)(
    GLenum target, GLint level, GLint xoffset, GLint yoffset,
    GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);

@bog-dan-ro
Copy link
Author

If you manually add -D__LP64__ on a 32-bit system, you're gonna have a bad time. A really, really bad time.

Yup, I've seen it :)

Looks like the incompatibility in the case is just the attribute((aapcs))? Are you using armeabi-v7a-hard?

Yep "attribute((aapcs))" is the problem, I just don't know why gcc didn't warned me about it... or this is a false positive clang error, considering that function signature has no floating-point params ...

No, I'm not using v7a-hard, I'm using "-target armv7-none-linux-androideabi -march=armv7-a -mfpu=vfp -mfloat-abi=softfp ....".

@bog-dan-ro
Copy link
Author

bog-dan-ro commented May 27, 2016

@DanAlbert just to be crystal clear: __NDK_FPABI__ should be defined as __attribute__((pcs("aapcs"))) when compiles with "-target armv7-none-linux-androideabi -march=armv7-a -mfpu=vfp -mfloat-abi=softfp" flags?

@DanAlbert
Copy link
Member

__NDK_FPABI__ can be empty for -mfloat-abi=softfp. That's the default.

The hard float ABI is going away with r12. You should be able to ignore __NDK_FPABI__.

@bog-dan-ro
Copy link
Author

bog-dan-ro commented May 31, 2016

Can be or should be? :)
If should be, then you should reopen this issue because, I just test it with r12 beta2 and clang still defines __attribute__((pcs("aapcs"))) ;-(

@DanAlbert
Copy link
Member

I guess I forgot to actually hit the re-open button, but I did actually make another pass at this in r13. All the aapcs stuff has been completely purged from our headers now, so everything should Just Work.

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

No branches or pull requests

2 participants