Long double macros#19242
Conversation
be6341f to
2668466
Compare
|
Can someone confirm that MSVC always treats |
18be687 to
deec17f
Compare
deec17f to
f2f4182
Compare
f2f4182 to
24b28a6
Compare
|
@Cynerd flash can't hold the final image: |
I have noticed. I will look into it, but this is most likely because some code is now correctly compiled in for |
|
@xiaoxiang781216 this MR is not the fault. I just checked build and this is without this commit: and this is with this commit: That is what I expected to see. Pretty much the same size because the code for 64-bit float was just replaced with 128-bit float. But once I pull the latest apps I have the same issue as reported by CI: |
|
@xiaoxiang781216 I did apps bisect and funily enough it was your commit that tipped the scale apache/nuttx-apps@5ead824. hanzhijian's changes also added some space as it seems ( |
let' optimize the defconfig to reduce the code size. |
fix here: #19247 |
This addresses "FIX ME" definitions for the long double. These might not be all long double format supported by NuttX. The support was also added only for GCC alike compilers. Other compilers that have CONFIG_HAVE_LONG_DOUBLE defined will fail with error that mantisage digits have to be defined for that compiler. Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
NuttX defines constants for the sizes of types just as constants directly in the code. The real values depend on compiler and target platform. It is possible that value declared by NuttX header is wrong compared to the compiler configuration. This is more likely in case of floating points. Not all compilers supported by NuttX provide required info through defines and thus it is more generic to specify limits as constants, but in case compiler provides them then it is a good idea to compare. This commit adds such set of comparisons for limits.h and float.h constants. The comparisons were tested with GCC and Clang. They will be ignored in case compiler doesn't provide them. Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
This reuses implementation of trunc in case long double has same size as double. The previous implementation is used only in case x87 80-bit float point is the long double. In other cases the logic is intentionally replaced with panic to not provide a wrong result. Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
24b28a6 to
4e21440
Compare
Summary
This fixes the issue discovered with a new versions of GCC:
This was originally submitted in #18480, but that failed to approach the missing
long doubledefinitions.Impact
The changes were only covered for GCC and Clang. I haven't add definition for other compilers. Thus this will break compilers that have
CONFIG_HAVE_LONG_DOUBLEdefined. I put toggether the following list:CONFIG_HAVE_LONG_DOUBLE)CONFIG_HAVE_LONG_DOUBLE)Please, can anyone deduce the correct definitions for these compilers?
The second impact is that I added
limits_check.cto verify that we have correct constants set by comparing that against the definitions the compiler provides. This can trip on some platforms, of course.Lastly, I am not sure whether I covered all possible long double types that could occur in NuttX. One notable omission I know about is IBM float, but as far as I can see, it wasn't covered for double either.
Testing
I tried to compile these changes on
sim:nsh,same70-xplained:nsh, andrv-virt:nshwith gcc. No warnings or errors were introduced and in case of same70 the referenced warnigs are gone.