Patchwork configure patch for caddr_t and ssize_t types

login
register
mail settings
Submitter Steve Ellcey
Date Nov. 1, 2013, 6:15 p.m.
Message ID <0d3f2fde-d0d3-4430-bf3a-8b6ad16602aa@BAMAIL02.ba.imgtec.org>
Download mbox | patch
Permalink /patch/287882/
State New
Headers show

Comments

Steve Ellcey - Nov. 1, 2013, 6:15 p.m.
While doing a canadian cross build I ran into a problem with the caddr_t
type.  configure.ac is using an obsolete version of AC_CHECK_TYPE to
create #define's of caddr_t and ssize_t if they are not defined by the
system.  In addition to using an obsolete version of AC_CHECK_TYPE this
was causing a problem in my build because caddr_t was also getting set via
a typedef by the mingw compilers.

Here is my fix, tested with a canadian cross build and with a native x86
linux build.

OK to checkin?


2013-11-01  Steve Ellcey  <sellcey@mips.com>

	* configure.ac: Add header checks for fenv.h and complex.h.
	* configure: Regenerate.
	* config.in: Regnerate.
	* system.h: Add default caddr_t and ssize_t typedefs.
Marek Polacek - Nov. 1, 2013, 6:22 p.m.
On Fri, Nov 01, 2013 at 11:15:02AM -0700, Steve Ellcey  wrote:
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -1060,6 +1060,14 @@ helper_const_non_const_cast (const char *p)
>  #define DEBUG_VARIABLE
>  #endif
>  
> +#ifndef HAVE_CADDR_T
> +typedef char *caddr_t;
> +#endif
> +
> +#ifndef HAVE_SSIZE_T
> +typedef int ssize_t
> +#endif

Missing ';'?

	Marek
Steve Ellcey - Nov. 1, 2013, 6:28 p.m.
On Fri, 2013-11-01 at 19:22 +0100, Marek Polacek wrote:
> On Fri, Nov 01, 2013 at 11:15:02AM -0700, Steve Ellcey  wrote:
> > --- a/gcc/system.h
> > +++ b/gcc/system.h
> > @@ -1060,6 +1060,14 @@ helper_const_non_const_cast (const char *p)
> >  #define DEBUG_VARIABLE
> >  #endif
> >  
> > +#ifndef HAVE_CADDR_T
> > +typedef char *caddr_t;
> > +#endif
> > +
> > +#ifndef HAVE_SSIZE_T
> > +typedef int ssize_t
> > +#endif
> 
> Missing ';'?
> 
> 	Marek

Yes.  Both my cross build and my native build set HAVE_SSIZE_T so I
didn't see this.  I really only changed ssize_t to make it consistent
with caddr_t (which was causing me a problem) and to remove the use of
the obsolete form of AC_CHECK_TYPE.

Steve Ellcey
sellcey@mips.com

Patch

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5e686db..bc87073 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1075,8 +1075,8 @@  int main()
   fi
 fi
 
-AC_CHECK_TYPE(ssize_t, int)
-AC_CHECK_TYPE(caddr_t, char *)
+AC_CHECK_TYPES([ssize_t])
+AC_CHECK_TYPES([caddr_t])
 
 GCC_AC_FUNC_MMAP_BLACKLIST
 
diff --git a/gcc/system.h b/gcc/system.h
index a1fc6de..108ec0e 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -1060,6 +1060,14 @@  helper_const_non_const_cast (const char *p)
 #define DEBUG_VARIABLE
 #endif
 
+#ifndef HAVE_CADDR_T
+typedef char *caddr_t;
+#endif
+
+#ifndef HAVE_SSIZE_T
+typedef int ssize_t
+#endif
+
 /* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT.  */
 #include "hwint.h"