summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/flex
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 /meta/recipes-devtools/flex
parenta5afc58319d3c7e082a090f5fad7f89bd6e588c9 (diff)
downloadpoky-5612bf33391e839ed3efc1cf3a6794c1713cfdf7.tar.gz
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>
Diffstat (limited to 'meta/recipes-devtools/flex')
-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 @@
1Wrap ECHO macro to avoid FORTIFY warnings
2
3This change will enable flex scanners to be compiled with
4-D_FORTIFY_SOURCE=2.
5
6Signed-off-by: Manoj Srivastava <srivasta@debian.org>
7Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
8
9Origin: Cherry picked from Debian
10Upstream-Status: Pending
11
12---
13 flex.skl | 2 +-
14 scan.c | 2 +-
15 skel.c | 2 +-
16 3 files changed, 3 insertions(+), 3 deletions(-)
17
18diff --git a/flex.skl b/flex.skl
19index 6ebf2fd..eaa355e 100644
20--- a/flex.skl
21+++ b/flex.skl
22@@ -1074,7 +1074,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
23 /* This used to be an fputs(), but since the string might contain NUL's,
24 * we now use fwrite().
25 */
26-#define ECHO fwrite( yytext, yyleng, 1, yyout )
27+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
28 %endif
29 %if-c++-only C++ definition
30 #define ECHO LexerOutput( yytext, yyleng )
31diff --git a/scan.c b/scan.c
32index d7f5db3..1a079bf 100644
33--- a/scan.c
34+++ b/scan.c
35@@ -2093,7 +2093,7 @@ static int input (void );
36 /* This used to be an fputs(), but since the string might contain NUL's,
37 * we now use fwrite().
38 */
39-#define ECHO fwrite( yytext, yyleng, 1, yyout )
40+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
41 #endif
42
43 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
44diff --git a/skel.c b/skel.c
45index ee9f6ef..b8a2b4b 100644
46--- a/skel.c
47+++ b/skel.c
48@@ -1141,7 +1141,7 @@ const char *skel[] = {
49 "/* This used to be an fputs(), but since the string might contain NUL's,",
50 " * we now use fwrite().",
51 " */",
52- "#define ECHO fwrite( yytext, yyleng, 1, yyout )",
53+ "#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)",
54 "%endif",
55 "%if-c++-only C++ definition",
56 "#define ECHO LexerOutput( yytext, yyleng )",
57--
581.7.9.5
59
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 @@
1int is not the same size as size_t.
2
3Signed-off-by: Manoj Srivastava <srivasta@debian.org>
4Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
5
6Origin: Cherry picked from Debian
7Upstream-Status: Pending
8
9---
10 gen.c | 2 +-
11 scan.c | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/gen.c b/gen.c
15index 848e2c5..5a5daef 100644
16--- a/gen.c
17+++ b/gen.c
18@@ -1890,7 +1890,7 @@ void make_tables ()
19 outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
20 outn ("\t\t{ \\");
21 outn ("\t\tint c = '*'; \\");
22- outn ("\t\tint n; \\");
23+ outn ("\t\tsize_t n; \\");
24 outn ("\t\tfor ( n = 0; n < max_size && \\");
25 outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
26 outn ("\t\t\tbuf[n] = (char) c; \\");
27diff --git a/scan.c b/scan.c
28index 44559b6..15e2058 100644
29--- a/scan.c
30+++ b/scan.c
31@@ -2105,7 +2105,7 @@ static int input (void );
32 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
33 { \
34 int c = '*'; \
35- int n; \
36+ size_t n; \
37 for ( n = 0; n < max_size && \
38 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
39 buf[n] = (char) c; \
40--
411.7.9.5
42
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 @@
1require flex.inc 1require flex.inc
2PR = "r2" 2PR = "r3"
3LICENSE="BSD" 3LICENSE="BSD"
4LIC_FILES_CHKSUM = "file://COPYING;md5=e4742cf92e89040b39486a6219b68067" 4LIC_FILES_CHKSUM = "file://COPYING;md5=e4742cf92e89040b39486a6219b68067"
5BBCLASSEXTEND = "native" 5BBCLASSEXTEND = "native"
6 6
7SRC_URI += "file://avoid-FORTIFY-warnings.patch \
8 file://int-is-not-the-same-size-as-size_t.patch"
9
7SRC_URI[md5sum] = "10714e50cea54dc7a227e3eddcd44d57" 10SRC_URI[md5sum] = "10714e50cea54dc7a227e3eddcd44d57"
8SRC_URI[sha256sum] = "0becbd4b2b36b99c67f8c22ab98f7f80c9860aec70f0350a0018f29a88704e7b" 11SRC_URI[sha256sum] = "0becbd4b2b36b99c67f8c22ab98f7f80c9860aec70f0350a0018f29a88704e7b"