🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1751

bison-1.03/bison.simple patch for HPUX/gcc

#1751
From: Jim Meyering
Date: Fri, 23 Feb 1990 03:17
79 lines
3074 bytes
The problem is not in making bison, but rather in using its
parsers: bcopy is used in bison.simple and in the same file,
alloca needed a __GNUC__ hook.

The latest entry in bison's ChangeLog:
    Wed Aug 23 15:03:07 1989  Jay Fenlason  (hack at gnu)

I recently installed bison, then flex on hp9k300 HPUX 6.x using gcc.
The single problem I found was in making flex's parser using bison:
All compiles went fine, but at link time, two symbols were still
undefined: bcopy and alloca.  These I traced back to parse.o;
the references were from 'bison.simple.'

Here is a patch that worked for me -- though it would be nicer to
keep system dependencies out of such ``template'' files... maybe
an automatically generated separate version for people who use
memcpy instead of bcopy?  Otherwise, every time a SYSV user uses
a bison-generated parser, they have to remember to -DUSG or link
in a BSD library.

*** bison.simple.orig	Wed Apr 12 13:12:40 1989
--- bison.simple	Thu Feb 22 19:51:44 1990
***************
*** 19,27 ****
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
  
! #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  #include <alloca.h>
  #endif
  
  /* This is the parser code that is written into each bison parser
    when the %semantic_parser declaration is not specified in the grammar.
--- 19,33 ----
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
  
! #ifdef __GNUC__
! #define alloca __builtin_alloca
! #else
! #ifdef sparc
  #include <alloca.h>
+ #else
+ char *alloca ();
  #endif
+ #endif
  
  /* This is the parser code that is written into each bison parser
    when the %semantic_parser declaration is not specified in the grammar.
***************
*** 175,180 ****
--- 181,192 ----
        if (yymaxdepth > YYMAXLIMIT)
  	yymaxdepth = YYMAXLIMIT;
        yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
+ #ifndef bcopy
+ #if defined(SYS_V) || defined(USG)
+ #define bcopy(src, dst, num) memcpy((dst), (src), (num))
+ #define BCOPY_DEFINED
+ #endif
+ #endif
        bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
        yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
        bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
***************
*** 181,186 ****
--- 193,202 ----
  #ifdef YYLSP_NEEDED
        yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
        bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+ #endif
+ #ifdef BCOPY_DEFINED
+ #undef BCOPY_DEFINED
+ #undef bcopy
  #endif
  #endif /* no yyoverflow */
  
-- 
Jim Meyering      meyering@cs.utexas.edu
Technical Details
Message-ID: <682@ai.cs.utexas.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!meyering

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!meyering
From: meyering@cs.utexas.edu (Jim Meyering)
Newsgroups: gnu.utils.bug
Subject: bison-1.03/bison.simple patch for HPUX/gcc
Summary: using (not making) bison parsers: alloca, bcopy undefined
Message-ID: <682@ai.cs.utexas.edu>
Date: 23 Feb 90 03:17:54 GMT
Organization: U of TX at Austin CS Dept
Lines: 79