On Mon, Jun 10, 2019 at 08:58:00PM +0100, Jozef Lawrynowicz wrote: > On Mon, 10 Jun 2019 13:32:42 -0500 > Segher Boessenkool <seg...@kernel.crashing.org> wrote: > > That is not a fix, that is sweeping the problem under the rug. > > > > As a somewhat dirty hack I added > > > > #if __MSP430X_LARGE__ > > #undef __SIZE_TYPE__ > > __extension__ typedef unsigned __int20 __SIZE_TYPE__; > > #endif > > > > to the start of the installed stddef.h, and that fixes the problem fine, > > for correct programs that do not forget to include <stddef.h> (directly > > or indirectly), anyway.
> But we have some 850 generic tests in gcc/testsuite that use __SIZE_TYPE__ > without including stddef.h. They just rely on the preprocessor to expand this > using the builtin macro definition. I did say it is a dirty hack, right? You could call lang_hooks.types.register_builtin_type defining the type __SIZE_TYPE__ as the int20 partial int type, and then define SIZE_TYPE as just __SIZE_TYPE__. That is the same effectively, just not using the header file. So something like tree type_node = builtin_type_for_size (20, 1); lang_hooks.types.register_builtin_type (type_node, "__SIZE_TYPE__"); or maybe tree type_node = builtin_type_for_size (POINTER_SIZE, 1); lang_hooks.types.register_builtin_type (type_node, "__SIZE_TYPE__"); in msp430.c, and #define SIZE_TYPE "__SIZE_TYPE__" in msp430.h? Segher