This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libstdc++] intptr_t usage
Mark Mitchell wrote:
How about adding __INTPTR_TYPE__ to the builtin defines, like
__SIZE_TYPE__ and __PTRDIFF_TYPE__?
Something like the below? If you find it reasonable I can to add to it a
couple of lines of docs and use it in the library.
Paolo.
/////////////
Index: c-cppbuiltin.c
===================================================================
--- c-cppbuiltin.c (revision 123359)
+++ c-cppbuiltin.c (working copy)
@@ -381,8 +381,7 @@
gcc_assert (!*v || *v == ' ' || *v == '-');
}
-/* Define macros used by <stdint.h>. Currently only defines limits
- for intmax_t, used by the testsuite. */
+/* Define macros used by <stdint.h>. */
static void
builtin_define_stdint_macros (void)
{
@@ -396,6 +395,11 @@
else
gcc_unreachable ();
builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long);
+
+ builtin_define_with_value ("__INTPTR_TYPE__", "int __attribute__ "
+ "((__mode__ (__pointer__)))", 0);
+ builtin_define_with_value ("__UINTPTR_TYPE__", "unsigned int __attribute__ "
+ "((__mode__ (__pointer__)))", 0);
}
/* Hook that registers front end and target-specific built-ins. */