flex: Update to 2.6.4

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer 2019-02-14 20:56:40 +00:00
parent 8c00dee0fc
commit 678f98543e
3 changed files with 63 additions and 82 deletions

View File

@ -4,8 +4,8 @@
###############################################################################
name = flex
version = 2.5.39
release = 2.1
version = 2.6.4
release = 1
groups = Development/Tools
url = http://flex.sourceforge.net/
@ -24,12 +24,15 @@ description
build process.
end
source_dl = http://prdownloads.sourceforge.net/flex/
source_dl = https://github.com/westes/flex/releases/download/v%{version}/
build
requires
autoconf
automake
bison
gcc-c++
help2man
m4
end

View File

@ -1,79 +0,0 @@
From 35aba3d6e3c99fcd527c677bef8efeb59963fe8a Mon Sep 17 00:00:00 2001
Message-Id: <35aba3d6e3c99fcd527c677bef8efeb59963fe8a.1397340102.git.srivasta@golden-gryphon.com>
From: Manoj Srivastava <srivasta@golden-gryphon.com>
Date: Wed, 9 Apr 2014 00:23:07 -0700
Subject: [PATCH 1/1] [bison-test-fixes] Do not use obsolete bison constructs in tests.
In Bison 3.0, support for YYLEX_PARAM and YYPARSE_PARAM has been
removed (deprecated in Bison 1.875): use %lex-param, %parse-param, or
%param. This commit fixes the tests so they still work.
Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
---
tests/test-bison-yylloc/parser.y | 4 ++--
tests/test-bison-yylval/parser.y | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
50.0% tests/test-bison-yylloc/
50.0% tests/test-bison-yylval/
diff --git a/tests/test-bison-yylloc/parser.y b/tests/test-bison-yylloc/parser.y
index e8f4e56..224d252 100644
--- a/tests/test-bison-yylloc/parser.y
+++ b/tests/test-bison-yylloc/parser.y
@@ -22,6 +22,7 @@
*/
%parse-param { void* scanner }
+%lex-param { void* scanner }
/*
How to compile:
@@ -34,7 +35,6 @@
#include "config.h"
#define YYERROR_VERBOSE 1
-#define YYLEX_PARAM scanner
extern int testget_lineno(void*);
@@ -52,7 +52,7 @@ int process_text(char* s) {
%}
-%pure_parser
+%pure-parser
%union {
int lineno;
diff --git a/tests/test-bison-yylval/parser.y b/tests/test-bison-yylval/parser.y
index 0ffdb89..626c5e7 100644
--- a/tests/test-bison-yylval/parser.y
+++ b/tests/test-bison-yylval/parser.y
@@ -26,6 +26,7 @@
bison --defines --output-file="parser.c" --name-prefix="test" parser.y
*/
%parse-param { void* scanner }
+%lex-param { void* scanner }
%{
#include <stdio.h>
#include <stdlib.h>
@@ -33,7 +34,6 @@
#include "config.h"
#define YYERROR_VERBOSE 1
-#define YYLEX_PARAM scanner
/* A dummy function. A check against seg-faults in yylval->str. */
@@ -49,7 +49,7 @@ int process_text(char* s) {
%}
-%pure_parser
+%pure-parser
%union {
long unused;
--
1.9.2

View File

@ -0,0 +1,57 @@
From 23797fd0b0908dd2c5775e6135728c7384f4e952 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz@NetBSD.org>
Date: Fri, 19 May 2017 10:22:44 +0200
Subject: [PATCH] Use reallocarr() when available.
Fixes https://github.com/westes/flex/issues/219
---
configure.ac | 1 +
src/misc.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 55e774b0..d0f3b7da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,7 @@ strtol dnl
AC_CHECK_FUNCS([dnl
pow dnl Used only by "examples/manual/expr"
setlocale dnl Needed only if NLS is enabled
+reallocarr dnl NetBSD function. Use reallocarray if not available.
reallocarray dnl OpenBSD function. We have replacement if not available.
])
diff --git a/src/misc.c b/src/misc.c
index ef27833c..39483ea8 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -142,7 +142,14 @@ void add_action (const char *new_text)
void *allocate_array (int size, size_t element_size)
{
void *mem;
-#if HAVE_REALLOCARRAY
+#if HAVE_REALLOCARR
+ mem = NULL;
+ if (reallocarr(&mem, (size_t) size, element_size))
+ flexfatal (_
+ ("memory allocation failed in allocate_array()"));
+
+ return mem;
+#elif HAVE_REALLOCARRAY
/* reallocarray has built-in overflow detection */
mem = reallocarray(NULL, (size_t) size, element_size);
#else
@@ -659,7 +666,12 @@ char *readable_form (int c)
void *reallocate_array (void *array, int size, size_t element_size)
{
void *new_array;
-#if HAVE_REALLOCARRAY
+#if HAVE_REALLOCARR
+ if (reallocarr(&array, (size_t) size, element_size))
+ flexfatal (_("attempt to increase array size failed"));
+
+ return array;
+#elif HAVE_REALLOCARRAY
/* reallocarray has built-in overflow detection */
new_array = reallocarray(array, (size_t) size, element_size);
#else