This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Use GCC_HEADER_STDINT instead of stdint.h


> I'm not sure about this change. ÂAs far as I can tell, this is only
> being suggested for a single instance of uint64_t. ÂI note that the
> gcc configure script already calls AC_TYPE_UINT64_T (indirectly via
> GCC_STDINT_TYPES). ÂI think it might be simpler to do something like
>
> #ifdef HAVE_STDINT_H
> #include <stdint.h>
> #elif defined(HAVE_INTTYPES_H)
> #include <inttypes.h>
> #endif
> #include <sys/types.h>
> #if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && !defined(HAVE_UINT64_T) && !defined(uint64_t)
> #error can not find uint64_t type
> #endif

I think the attached patch does what you suggested. I tested it on Linux.
Rainer, can you check that this patch fixes the problem on systems without
stdint.h or inttypes.h?

include/
2009-10-09  Rafael Avila de Espindola  <espindola@google.com>

       PR40790
	* plugin-api.h: Don't include stdint.h unconditionally.

lto-plugin/
2009-10-09  Rafael Avila de Espindola  <espindola@google.com>

	PR40790
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* configure.ac: Add AC_TYPE_UINT64_T.
	* aclocal.m4: Regenerate.

> Ian
>

Thanks,
-- 
Rafael Ãvila de EspÃndola
Index: include/plugin-api.h
===================================================================
--- include/plugin-api.h	(revision 152593)
+++ include/plugin-api.h	(working copy)
@@ -26,8 +26,17 @@
 #ifndef PLUGIN_API_H
 #define PLUGIN_API_H
 
+#ifdef HAVE_STDINT_H
 #include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
+#endif
 #include <sys/types.h>
+#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && \
+    !defined(HAVE_UINT64_T) && !defined(uint64_t)
+#error can not find uint64_t type
+#endif
+#include <sys/types.h>
 
 #ifdef __cplusplus
 extern "C"
Index: lto-plugin/configure.ac
===================================================================
--- lto-plugin/configure.ac	(revision 152593)
+++ lto-plugin/configure.ac	(working copy)
@@ -7,6 +7,7 @@
 AC_ARG_VAR(LIBELFINC,[How to find libelf include files])
 AM_PROG_LIBTOOL
 AC_SUBST(target_noncanonical)
+AC_TYPE_UINT64_T
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT
 AC_SYS_LARGEFILE

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]