flex 2.3 patch #2

Vern Paxson vern at fjalar.cs.cornell.edu
Thu Aug 2 15:26:54 AEST 1990


Here's the second patch for release 2.3 of flex (you probably never saw
the first patch, as it was not posted to comp.sources.bugs, and is
superceded by this patch).  It fixes (I hope) problems involving
declaring malloc() and free() for gcc and g++ compilations.

flex 2.3 should be showing up on comp.sources.unix next week, with
this patch already integrated into it ...

		Vern

	Vern Paxson			      vern at cs.cornell.edu
	Computer Science Dept.		      decvax!cornell!vern
	Cornell University


diff -c Original/Changes Patch-2/Changes
*** Original/Changes	Thu Jun 28 00:44:07 1990
--- Patch-2/Changes	Thu Aug  2 01:09:22 1990
***************
*** 1,3 ****
--- 1,16 ----
+ Changes between 2.3 Patch #2 (02Aug90) and original 2.3 release:
+ 
+ 	- Fixed (hopefully) headaches involving declaring malloc()
+ 	  and free() for gcc, which defines __STDC__ but (often) doesn't
+ 	  come with the standard include files such as <stdlib.h>.
+ 	  Reordered #ifdef maze in the scanner skeleton in the hope of
+ 	  getting the declarations right for cfront and g++, too.
+ 
+ 	- Note that this patch supercedes patch #1 for release 2.3,
+ 	  which was never announced but was available briefly for
+ 	  anonymous ftp.
+ 
+ 
  Changes between 2.3 (full) release of 28Jun90 and 2.2 (alpha) release:
  
      User-visible:
diff -c Original/flex.skel Patch-2/flex.skel
*** Original/flex.skel	Thu Jun 28 00:44:27 1990
--- Patch-2/flex.skel	Thu Aug  2 01:09:23 1990
***************
*** 1,7 ****
  /* A lexical scanner generated by flex */
  
  /* scanner skeleton version:
!  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.13 90/05/26 17:24:13 vern Exp $
   */
  
  #define FLEX_SCANNER
--- 1,7 ----
  /* A lexical scanner generated by flex */
  
  /* scanner skeleton version:
!  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.15 90/08/02 01:01:07 vern Exp $
   */
  
  #define FLEX_SCANNER
***************
*** 8,27 ****
  
  #include <stdio.h>
  
- #ifdef __STDC__
  
- #ifndef DONT_HAVE_STDLIB_H
- #include <stdlib.h>
- #else
- void *malloc( unsigned );
- void free( void* );
- #endif
- 
- #define YY_USE_PROTOS
- #define YY_USE_CONST
- #endif
- 
- 
  /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  #ifdef c_plusplus
  #ifndef __cplusplus
--- 8,14 ----
***************
*** 32,41 ****
  
  #ifdef __cplusplus
  
- #ifndef __STDC__
  #include <stdlib.h>
- #endif
- 
  #include <osfcn.h>
  
  /* use prototypes in function declarations */
--- 19,25 ----
***************
*** 44,52 ****
  /* the "const" storage-class-modifier is valid */
  #define YY_USE_CONST
  
! #endif
  
  
  #ifdef __TURBOC__
  #define YY_USE_CONST
  #endif
--- 28,51 ----
  /* the "const" storage-class-modifier is valid */
  #define YY_USE_CONST
  
! #else	/* ! __cplusplus */
  
+ #ifdef __STDC__
  
+ #ifdef __GNUC__
+ void *malloc( unsigned );
+ void free( void* );
+ #else
+ #include <stdlib.h>
+ #endif	/* __GNUC__ */
+ 
+ #define YY_USE_PROTOS
+ #define YY_USE_CONST
+ 
+ #endif	/* __STDC__ */
+ #endif	/* ! __cplusplus */
+ 
+ 
  #ifdef __TURBOC__
  #define YY_USE_CONST
  #endif
***************
*** 61,67 ****
  #define YY_PROTO(proto) proto
  #else
  #define YY_PROTO(proto) ()
! /* there's no standard place to get these definitions */
  char *malloc();
  int free();
  int read();
--- 60,69 ----
  #define YY_PROTO(proto) proto
  #else
  #define YY_PROTO(proto) ()
! /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
!  * so it's got to be a K&R compiler, and therefore there's no standard
!  * place from which to include these definitions
!  */
  char *malloc();
  int free();
  int read();
diff -c Original/flexdef.h Patch-2/flexdef.h
*** Original/flexdef.h	Thu Jun 28 00:44:27 1990
--- Patch-2/flexdef.h	Thu Aug  2 00:42:54 1990
***************
*** 26,32 ****
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   */
  
! /* @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/flexdef.h,v 2.7 90/06/27 23:48:19 vern Exp $ (LBL) */
  
  #ifndef FILE
  #include <stdio.h>
--- 26,32 ----
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   */
  
! /* @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/flexdef.h,v 2.9 90/08/02 00:31:02 vern Exp $ (LBL) */
  
  #ifndef FILE
  #include <stdio.h>
***************
*** 90,96 ****
--- 90,107 ----
  #define SHORT_FILE_NAMES
  #endif
  
+ #ifdef __STDC__
+ 
+ #ifdef __GNUC__
+ void *malloc( unsigned );
+ void free( void* );
+ #else
+ #include <stdlib.h>
+ #endif
+ 
+ #else	/* ! __STDC__ */
  char *malloc(), *realloc();
+ #endif
  
  
  /* maximum line length we'll have to deal with */



More information about the Comp.sources.bugs mailing list