diff mbox series

[oe,meta-oe,2/4] p7zip: Fix build with clang

Message ID 20180426170004.20602-2-raj.khem@gmail.com
State Accepted
Commit f225823e22c720965334f5be613183fa11a612b3
Headers show
Series [oe,meta-oe,1/4] ceres-solver: Upgrade to 1.14 | expand

Commit Message

Khem Raj April 26, 2018, 5 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...Fix-narrowing-errors-Wc-11-narrowing.patch | 48 +++++++++++++++++++
 meta-oe/recipes-extended/p7zip/p7zip_16.02.bb |  6 ++-
 2 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch

-- 
2.17.0

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

Patch

diff --git a/meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch b/meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch
new file mode 100644
index 000000000..ae2751745
--- /dev/null
+++ b/meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch
@@ -0,0 +1,48 @@ 
+From b6b1782af4aa7f9084d32e4144738dc2535c8d6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 23 Apr 2018 23:07:21 -0700
+Subject: [PATCH] Fix narrowing errors -Wc++11-narrowing
+
+Clang 6.x finds these errors
+
+    ../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
+        case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
+             ^
+
+HRESULT causes the macro to be parsed as a signed long, so we need to force it
+to be checked as an unsigned long instead.
+
+also reported here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224930
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CPP/Windows/ErrorMsg.cpp | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp
+index 99684ae..78a64ba 100644
+--- a/CPP/Windows/ErrorMsg.cpp
++++ b/CPP/Windows/ErrorMsg.cpp
+@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
+ 
+   switch(errorCode) {
+     case ERROR_NO_MORE_FILES   : txt = "No more files"; break ;
+-    case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
+-    case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
+-    case E_ABORT               : txt = "E_ABORT"; break ;
+-    case E_FAIL                : txt = "E_FAIL"; break ;
+-    case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
+-    case E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
+-    case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
++    case (DWORD) E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
++    case (DWORD) E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
++    case (DWORD) E_ABORT               : txt = "E_ABORT"; break ;
++    case (DWORD) E_FAIL                : txt = "E_FAIL"; break ;
++    case (DWORD) STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
++    case (DWORD) E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
++    case (DWORD) E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
+     case ERROR_DIRECTORY          : txt = "Error Directory"; break ;
+     default:
+       txt = strerror(errorCode);
diff --git a/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb b/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
index edf47f7bc..d986da904 100644
--- a/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
+++ b/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
@@ -6,8 +6,10 @@  LIC_FILES_CHKSUM = "file://DOC/copying.txt;md5=4fbd65380cdd255951079008b364516c
                     file://DOC/License.txt;md5=879598edf1f54dddb6930d7581357f8b"
 
 SRC_URI = "http://downloads.sourceforge.net/p7zip/p7zip/${PV}/p7zip_${PV}_src_all.tar.bz2 \
-          file://do_not_override_compiler_and_do_not_strip.patch \
-          file://CVE-2017-17969.patch"
+           file://do_not_override_compiler_and_do_not_strip.patch \
+           file://CVE-2017-17969.patch \
+           file://0001-Fix-narrowing-errors-Wc-11-narrowing.patch \
+           "
 
 SRC_URI[md5sum] = "a0128d661cfe7cc8c121e73519c54fbf"
 SRC_URI[sha256sum] = "5eb20ac0e2944f6cb9c2d51dd6c4518941c185347d4089ea89087ffdd6e2341f"