diff mbox series

grub: fix compile error with latest flex

Message ID 20180221144534.2844-1-ross.burton@intel.com
State New
Headers show
Series grub: fix compile error with latest flex | expand

Commit Message

Ross Burton Feb. 21, 2018, 2:45 p.m. UTC
With newer flex releases grub fails to build:

grub_script.yy.c: In function 'yy_fatal_error':
grub_script.yy.c:18:22: error: statement with no effect [-Werror=unused-value]

                      ^
grub_script.yy.c:2366:2: note: in expansion of macro 'fprintf'
  (void)yyg;
  ^~~~~~~

Backport a patch from upstream to fix this.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/recipes-bsp/grub/files/cast-fprintf.patch | 36 ++++++++++++++++++++++++++
 meta/recipes-bsp/grub/grub2.inc                |  4 +--
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-bsp/grub/files/cast-fprintf.patch

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/recipes-bsp/grub/files/cast-fprintf.patch b/meta/recipes-bsp/grub/files/cast-fprintf.patch
new file mode 100644
index 00000000000..b340d557070
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/cast-fprintf.patch
@@ -0,0 +1,36 @@ 
+grub_script.yy.c: In function 'yy_fatal_error':
+grub_script.yy.c:18:22: error: statement with no effect [-Werror=unused-value]
+ 
+                      ^
+grub_script.yy.c:2366:2: note: in expansion of macro 'fprintf'
+  (void)yyg;
+  ^~~~~~~
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From c36c2a86404f373100775305f532c09d46f3c6ce Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Mon, 14 Aug 2017 14:11:43 +0200
+Subject: yylex: Explicilty cast fprintf to void.
+
+It's needed to avoid warning on recent GCC.
+---
+ grub-core/script/yylex.l | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l
+index 95b2191..7b44c37 100644
+--- a/grub-core/script/yylex.l
++++ b/grub-core/script/yylex.l
+@@ -91,7 +91,7 @@ typedef size_t yy_size_t;
+ #define stdin  0
+ #define stdout 0
+ 
+-#define fprintf(...) 0
++#define fprintf(...) (void)0
+ #define exit(...) grub_fatal("fatal error in lexer")
+ #endif
+ 
+-- 
+cgit v1.0-41-gc330
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index 2ea31f64206..fc175406885 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -17,8 +17,8 @@  SRC_URI = "https://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
            file://autogen.sh-exclude-pc.patch \
            file://grub-module-explicitly-keeps-symbole-.module_license.patch \
            file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
-	   file://fix.build.with.gcc-7.patch \
-"
+           file://fix.build.with.gcc-7.patch \
+           file://cast-fprintf.patch"
 SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d"
 SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d"