summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2012-04-11 03:19:52 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-16 22:59:08 +0100
commit5612bf33391e839ed3efc1cf3a6794c1713cfdf7 (patch)
tree3a76e06a9ae750e739d9ef13f8dc9c17dbc7dbc0
parenta5afc58319d3c7e082a090f5fad7f89bd6e588c9 (diff)
downloadpoky-5612bf33391e839ed3efc1cf3a6794c1713cfdf7.tar.gz
poky-5612bf33391e839ed3efc1cf3a6794c1713cfdf7.tar.bz2
poky-5612bf33391e839ed3efc1cf3a6794c1713cfdf7.zip
flex: backport Debian patches to fix generated code warnings
The generated parser had warnings regarding signess and return check which makes Linux Kernel's perf tool from 3.4 release to fail without those patches. (From OE-Core rev: f3d7197252d1ede627a561fbd5b3b7fb759bf75b) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/flex/flex/avoid-FORTIFY-warnings.patch59
-rw-r--r--meta/recipes-devtools/flex/flex/int-is-not-the-same-size-as-size_t.patch42
-rw-r--r--meta/recipes-devtools/flex/flex_2.5.35.bb5
3 files changed, 105 insertions, 1 deletions
diff --git a/meta/recipes-devtools/flex/flex/avoid-FORTIFY-warnings.patch b/meta/recipes-devtools/flex/flex/avoid-FORTIFY-warnings.patch
new file mode 100644
index 0000000000..c71eb82792
--- /dev/null
+++ b/meta/recipes-devtools/flex/flex/avoid-FORTIFY-warnings.patch
@@ -0,0 +1,59 @@
+Wrap ECHO macro to avoid FORTIFY warnings
+
+This change will enable flex scanners to be compiled with
+-D_FORTIFY_SOURCE=2.
+
+Signed-off-by: Manoj Srivastava <srivasta@debian.org>
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
+
+Origin: Cherry picked from Debian
+Upstream-Status: Pending
+
+---
+ flex.skl | 2 +-
+ scan.c | 2 +-
+ skel.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/flex.skl b/flex.skl
+index 6ebf2fd..eaa355e 100644
+--- a/flex.skl
++++ b/flex.skl
+@@ -1074,7 +1074,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+ /* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+-#define ECHO fwrite( yytext, yyleng, 1, yyout )
++#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+ %endif
+ %if-c++-only C++ definition
+ #define ECHO LexerOutput( yytext, yyleng )
+diff --git a/scan.c b/scan.c
+index d7f5db3..1a079bf 100644
+--- a/scan.c
++++ b/scan.c
+@@ -2093,7 +2093,7 @@ static int input (void );
+ /* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+-#define ECHO fwrite( yytext, yyleng, 1, yyout )
++#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+ #endif
+
+ /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+diff --git a/skel.c b/skel.c
+index ee9f6ef..b8a2b4b 100644
+--- a/skel.c
++++ b/skel.c
+@@ -1141,7 +1141,7 @@ const char *skel[] = {
+ "/* This used to be an fputs(), but since the string might contain NUL's,",
+ " * we now use fwrite().",
+ " */",
+- "#define ECHO fwrite( yytext, yyleng, 1, yyout )",
++ "#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)",
+ "%endif",
+ "%if-c++-only C++ definition",
+ "#define ECHO LexerOutput( yytext, yyleng )",
+--
+1.7.9.5
+
diff --git a/meta/recipes-devtools/flex/flex/int-is-not-the-same-size-as-size_t.patch b/meta/recipes-devtools/flex/flex/int-is-not-the-same-size-as-size_t.patch
new file mode 100644
index 0000000000..8d05ee467c
--- /dev/null
+++ b/meta/recipes-devtools/flex/flex/int-is-not-the-same-size-as-size_t.patch
@@ -0,0 +1,42 @@
+int is not the same size as size_t.
+
+Signed-off-by: Manoj Srivastava <srivasta@debian.org>
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
+
+Origin: Cherry picked from Debian
+Upstream-Status: Pending
+
+---
+ gen.c | 2 +-
+ scan.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gen.c b/gen.c
+index 848e2c5..5a5daef 100644
+--- a/gen.c
++++ b/gen.c
+@@ -1890,7 +1890,7 @@ void make_tables ()
+ outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
+ outn ("\t\t{ \\");
+ outn ("\t\tint c = '*'; \\");
+- outn ("\t\tint n; \\");
++ outn ("\t\tsize_t n; \\");
+ outn ("\t\tfor ( n = 0; n < max_size && \\");
+ outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
+ outn ("\t\t\tbuf[n] = (char) c; \\");
+diff --git a/scan.c b/scan.c
+index 44559b6..15e2058 100644
+--- a/scan.c
++++ b/scan.c
+@@ -2105,7 +2105,7 @@ static int input (void );
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+- int n; \
++ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+--
+1.7.9.5
+
diff --git a/meta/recipes-devtools/flex/flex_2.5.35.bb b/meta/recipes-devtools/flex/flex_2.5.35.bb
index 28a4f1f06b..7419f101ad 100644
--- a/meta/recipes-devtools/flex/flex_2.5.35.bb
+++ b/meta/recipes-devtools/flex/flex_2.5.35.bb
@@ -1,8 +1,11 @@
require flex.inc
-PR = "r2"
+PR = "r3"
LICENSE="BSD"
LIC_FILES_CHKSUM = "file://COPYING;md5=e4742cf92e89040b39486a6219b68067"
BBCLASSEXTEND = "native"
+SRC_URI += "file://avoid-FORTIFY-warnings.patch \
+ file://int-is-not-the-same-size-as-size_t.patch"
+
SRC_URI[md5sum] = "10714e50cea54dc7a227e3eddcd44d57"
SRC_URI[sha256sum] = "0becbd4b2b36b99c67f8c22ab98f7f80c9860aec70f0350a0018f29a88704e7b"