On Wed, 15 Jan 2025 at 17:17, Georg-Johann Lay via Gcc <gcc@gcc.gnu.org> wrote: > > What's the recommended way to built-in define types like __uint24 ? > > Since v4.8, the avr backend has: > > avr-modes.def: > FRACTIONAL_INT_MODE (PSI, 24, 3); > > avr.cc: > tree int24_type = make_signed_type (GET_MODE_BITSIZE (PSImode)); > tree uint24_type = make_unsigned_type (GET_MODE_BITSIZE (PSImode)); > lang_hooks.types.register_builtin_type (int24_type, "__int24"); > lang_hooks.types.register_builtin_type (uint24_type, "__uint24"); > > Which > > 1) Doesn't support [un]signed __int24. > > 2) May run into ICEs like: > FAIL: gcc.target/avr/torture/int24-mul.c -O3 -g > (internal compiler error: in add_dwarf_attr, at dwarf2out.cc:4483) > FAIL: gcc.target/avr/torture/pr109907-2.c -O3 -g > (internal compiler error: in decompose, at rtl.h:2312) > > 3) __GLIBCXX_TYPE_INT_N_0 isn't defined (or has to be done by hand). > Though libc++ relies on 1). > > > Using > > avr-modes.def: > FRACTIONAL_INT_MODE (PSI, 24, 3); > INT_N (PSI, 24); > > solved at least 1) and 3), however it adds new FAILs due to: > > 4) error: ISO C does not support '__int24' types [-Wpedantic]
This pedwarn is correct, so I'm not sure why it's a problem. If you don't want warnings about non-standard extensions, don't use -pedantic-errors. > Is there a backwards compatible way to provide [un]signed __inz24 > that also works with older revisions of C without raising 4) ? This has nothing to do with "older revisions of C", does it?