]> git.saurik.com Git - bison.git/blobdiff - src/bison.simple
[__hpux]: Include alloca.h (right for HPUX 10)
[bison.git] / src / bison.simple
index 555df94a41af2154d5631f940ca296c20252664d..e3bcfb6d2746b541223e08924d318c88e0d6e291 100644 (file)
 #ifdef __GNUC__
 #define alloca __builtin_alloca
 #else /* not GNU C.  */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
 #include <alloca.h>
 #else /* not sparc */
 /* This used to test MSDOS, but that is a bad idea
    since that is in the user namespace.  */
-#if defined (_MSDOS_) && !defined (__TURBOC__)
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
 #include <malloc.h>
-#else /* not _MSDOS_, or __TURBOC__ */
+#else /* not MSDOS, or __TURBOC__ */
 #if defined(_AIX)
 #include <malloc.h>
  #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
+#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,8 +58,9 @@ void *alloca (unsigned int);
 void *alloca ();
 #endif /* not __cplusplus */
 #endif /* __hpux */
+#endif /* 0 */
 #endif /* not _AIX */
-#endif /* not _MSDOS_, or __TURBOC__ */
+#endif /* not MSDOS, or __TURBOC__ */
 #endif /* not sparc.  */
 #endif /* not GNU C.  */
 #endif /* alloca not defined.  */
@@ -149,12 +155,12 @@ int yydebug;                      /*  nonzero means print parse trace     */
 #ifndef YYMAXDEPTH
 #define YYMAXDEPTH 10000
 #endif
-
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-int yyparse (void);
-#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++ */
@@ -166,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;
@@ -181,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;
@@ -215,6 +221,15 @@ __yy_memcpy (char *to, char *from, int count)
 #define YYPARSE_PARAM_DECL
 #endif /* not YYPARSE_PARAM */
 
+/* Prevent warning if -Wstrict-prototypes.  */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int yyparse (void *);
+#else
+int yyparse (void);
+#endif
+#endif
+
 int
 yyparse(YYPARSE_PARAM_ARG)
      YYPARSE_PARAM_DECL
@@ -333,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 */