__SIZE_TYPE__ and friends out of specs
Zack Weinberg
zack@codesourcery.com
Tue May 14 15:38:00 GMT 2002
On Tue, May 14, 2002 at 05:59:29PM +0100, Neil Booth wrote:
> Zack Weinberg wrote:-
>
> > + /* stddef.h needs to know these. */
> > + builtin_define_with_value ("__SIZE_TYPE__", SIZE_TYPE);
> > + builtin_define_with_value ("__PTRDIFF_TYPE__", PTRDIFF_TYPE);
> > + builtin_define_with_value ("__WCHAR_TYPE__", WCHAR_TYPE);
> > + builtin_define_with_value ("__WINT_TYPE__", WINT_TYPE);
>
> Two more nits. I think the WCHAR one is best done as follows:
>
> builtin_define_with_value ("__WCHAR_TYPE__",
> IDENTIFIER_POINTER (wchar_type_node));
It is slightly hairier than that...
builtin_define_with_value ("__WCHAR_TYPE__",
({ tree name = TYPE_NAME (wchar_type_node);
if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name);
IDENTIFIER_POINTER (name); }));
(yes, I know I can't use this notation) and for consistency they
should all be done that way. Or, hrm, I could define a new macro to
wrap around WCHAR_TYPE that takes -fshort-wchar into account. Neither
approach seems great to me. Thoughts?
> Also, would you poison the removed macros?
Done in my copy.
zw
More information about the Gcc-patches
mailing list