]> git.saurik.com Git - bison.git/blobdiff - src/bison.simple
[__hpux]: Include alloca.h (right for HPUX 10)
[bison.git] / src / bison.simple
index 2c2d0a28b5038d781ac049ab0446e7122e9df0fe..e3bcfb6d2746b541223e08924d318c88e0d6e291 100644 (file)
 #include <malloc.h>
  #pragma alloca
 #else /* not MSDOS, or __TURBOC__, or _AIX */
+#ifdef __hpux /* This is right for HPUX 10.  */
+#include <alloca.h>
+#endif
+#if 0 /* This was right for HPUX 9.
+        Unfortunately there is no clean way to distinguish.  */
 #ifdef __hpux
 #ifdef __cplusplus
 extern "C" {
@@ -53,6 +58,7 @@ void *alloca (unsigned int);
 void *alloca ();
 #endif /* not __cplusplus */
 #endif /* __hpux */
+#endif /* 0 */
 #endif /* not _AIX */
 #endif /* not MSDOS, or __TURBOC__ */
 #endif /* not sparc.  */
@@ -150,6 +156,11 @@ int yydebug;                       /*  nonzero means print parse trace     */
 #define YYMAXDEPTH 10000
 #endif
 \f
+/* Define __yy_memcpy.  Note that the size argument
+   should be passed with type unsigned int, because that is what the non-GCC
+   definitions require.  With GCC, __builtin_memcpy takes an arg
+   of type size_t, but it can handle unsigned int.  */
+
 #if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
 #define __yy_memcpy(TO,FROM,COUNT)     __builtin_memcpy(TO,FROM,COUNT)
 #else                          /* not GNU C or C++ */
@@ -161,7 +172,7 @@ static void
 __yy_memcpy (to, from, count)
      char *to;
      char *from;
-     int count;
+     unsigned int count;
 {
   register char *f = from;
   register char *t = to;
@@ -176,7 +187,7 @@ __yy_memcpy (to, from, count)
 /* This is the most reliable way to avoid incompatibilities
    in available built-in functions on various systems.  */
 static void
-__yy_memcpy (char *to, char *from, int count)
+__yy_memcpy (char *to, char *from, unsigned int count)
 {
   register char *t = to;
   register char *f = from;
@@ -337,12 +348,15 @@ yynewstate:
       if (yystacksize > YYMAXDEPTH)
        yystacksize = YYMAXDEPTH;
       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
-      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
+      __yy_memcpy ((char *)yyss, (char *)yyss1,
+                  size * (unsigned int) sizeof (*yyssp));
       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
-      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
+      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
+                  size * (unsigned int) sizeof (*yyvsp));
 #ifdef YYLSP_NEEDED
       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
-      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
+      __yy_memcpy ((char *)yyls, (char *)yyls1,
+                  size * (unsigned int) sizeof (*yylsp));
 #endif
 #endif /* no yyoverflow */