-
Notifications
You must be signed in to change notification settings - Fork 153
Fix various warnings #125
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
Fix various warnings #125
Conversation
#if !(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)) | ||
|
||
#elif defined(__GLIBC__) | ||
#if defined(__GLIBC__) |
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.
Instead of leaving all of this code there, would it be worth just throwing it away and seeing what breaks? It may be the case that Windows is the only platform that doesn't define these. All the other systems use a compiler that provides support for these definitions.
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.
Given that I have no way to check other compilers, I'd rather keep these as it's not much code and it's pretty clear. Do you have any reference about what other compilers support? The only thing I have found is https://sourceforge.net/p/predef/wiki/Endianness/, which doesn't seem to say so.
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.
Speaking on behalf of FreeBSD, the __FreeBSD__
block can safely be removed.
Test failure happens since f7a18b5. |
src/fpmath.h
Outdated
#if _BYTE_ORDER == _LITTLE_ENDIAN | ||
#if _IEEE_WORD_ORDER == _LITTLE_ENDIAN | ||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
#if _IEEE_WORD_ORDER == __ORDER_LITTLE_ENDIAN__ |
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.
At least GCC provides __FLOAT_WORD_ORDER__
for this purpose. Would it make sense to also use this name directly instead of using _IEEE_WORD_ORDER?
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.
Indeed. Will fix.
78499bf
to
4f7b3de
Compare
src/fpmath.h
Outdated
#endif /* __BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__ and __ORDER_BIG_ENDIAN__ */ | ||
|
||
#ifndef __FLOAT_WORD_ORDER__ | ||
#define __FLOAT_WORD_ORDER__ __BYTE_ORDER__ |
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.
This is missing a space between #define
and __FLOAT_WORD_ORDER__
, right?
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.
Good catch, the file originally contained a tab. Fixed.
75cdbc4
to
f6063b5
Compare
I've pushed a new commit removing all unused macros from BTW, it seems to me that in |
I have reverted the -fno-builtins for now to get CI running again, and will turn it on more systematically later. |
If we can rebase this on master, we may be able to get a green. |
_LITTLE_ENDIAN and _BIG_ENDIAN are built-in on some platforms/versions. Better use __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__ and __BYTE_ORDER__, which are standard for gcc and clang, and define them when they are missing. Also remove the special-case for FreeBSD, which is apprently not needed.
Most macros were not actually used. This gets rid of warnings when building on Linux.
Cool, I've just rebased. Note that I've kept |
Thanks, that fixes the warnings on Power. |
Cc @edelsohn |
Cf. #117.