On Tue, Feb 15, 2022 at 06:05:06PM -0500, Michael Meissner wrote: > On Tue, Feb 15, 2022 at 04:05:11PM -0600, Segher Boessenkool wrote: > > On all older compilers these macros will not be defined, but the types > > often are. If you are willing to not support older compilers properly > > anyway, you could just *always* use the types, which will work with most > > very old compilers as well (and the approach using these propesed > > predefines will *not*!) > > The types are not defined on older systems.
They are defined since GCC 6. Using new macros to see if the types exist will miss all of GCC 6, 7, 8, 9, 10, 11. > Both __ibm128 (ibm128_float_type_node) and __float128 > (ieee128_float_type_node) > are only defined if TARGET_FLOAT128_TYPE is true. > > TARGET_FLOAT128_TYPE is only true if both TARGET_FLOAT128_ENABLE_TYPE and > TARGET_VSX are true. > > TARGET_FLOAT128_ENABLE_TYPE is only true on linux64 systems. > > Now, the code to set __SIZEOF_IBM128__ and __SIZEOF_FLOAT128__ is in the code > that also defines __FLOAT128__. This code checks whether the __float128 and > __ibm128 keywords are allowed. These keywords are only set if > TARGET_FLOAT128_TYPE is true, and if the user did not use the -mno-float128 > option. In the GCC 7 time frame, we did not set this by default, but in the > modern compilers, it is always set by default on Linux 64-bit systems. __SIZEOF_IBM128__ should be defined based on what we have for the __ibm128 type, not on what we have for the __float128 type Yes I know we *currently* define those under the same conditions, but why write code that is more fragile than needed? Please don't. It is easy to do it correctly, so it is no real hassle for the writer of the code, and it is much better for the reader. Segher