From 967afaa6d03d053f00d05592a5bdf7cfa5a40fee Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Wed, 27 Jun 2018 14:43:04 +0200 Subject: [PATCH] Remove g++ signed/unsigned comparison warning in generated scanner Compiling a flex generated scanner with g++ with all warnings turned on (-Wall) produces a warning due to "comparison of integer expressions of different signedness". This change removes the warning by using the same signedness. This bug was a regression inherited from upstream flex during the rebase to flex-2.6.1. The same bug was fixed previously (albeit differently) by commit a3088c99e8. --- flex-yybytes_len.patch | 24 ++++++++++++++++++++++++ flex.spec | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 flex-yybytes_len.patch diff --git a/flex-yybytes_len.patch b/flex-yybytes_len.patch new file mode 100644 index 0000000..9d204da --- /dev/null +++ b/flex-yybytes_len.patch @@ -0,0 +1,24 @@ +commit cf4121fa97abac8aeaa5e08b8fc0b2380228494e +Author: rlar +Date: Sat Feb 27 22:46:02 2016 +0100 + + generated code, `_yybytes_len' is of type `int', fix code accordingly + +Index: b/src/flex.skl +=================================================================== +--- a/src/flex.skl ++++ b/src/flex.skl +@@ -2451,11 +2451,11 @@ YY_BUFFER_STATE yy_scan_bytes YYFARGS2( + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; +- yy_size_t i; ++ int i; + m4_dnl M4_YY_DECL_GUTS_VAR(); + + /* Get memory for full buffer, including space for trailing EOB's. */ +- n = (yy_size_t) _yybytes_len + 2; ++ n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); diff --git a/flex.spec b/flex.spec index 37ee262..e8b73d7 100644 --- a/flex.spec +++ b/flex.spec @@ -3,7 +3,7 @@ Summary: A tool for creating scanners (text pattern recognizers) Name: flex Version: 2.6.1 -Release: 7%{?dist} +Release: 8%{?dist} # parse.c and parse.h are under GPLv3+ with exception which allows # relicensing. Since flex is shipped under BDS-style license, # let's assume that the relicensing was done. @@ -17,6 +17,7 @@ Patch0: flex-2.6.0-yyless.patch Patch1: flex-max_size.patch Patch2: flex-new_size.patch Patch3: flex-yy_buf_size.patch +Patch4: flex-yybytes_len.patch Requires: m4 BuildRequires: gettext bison m4 help2man @@ -66,6 +67,7 @@ plain text and PDF formats. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %build %configure --docdir=%{_pkgdocdir} CFLAGS="-fPIC $RPM_OPT_FLAGS" @@ -135,6 +137,9 @@ echo ============END TESTING=========== %{_pkgdocdir} %changelog +* Wed Jun 27 2018 Arjun Shankar - 2.6.1-8 +- Remove g++ signed/unsigned comparison warning in generated scanner + * Fri Feb 09 2018 Igor Gnatenko - 2.6.1-7 - Escape macros in %%changelog