diff mbox series

[meta-networking,21/21] ot-daemon,ot-br-posix: Fix mbedtls module builds

Message ID 20220830071413.3887189-21-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,01/21] gtk+: Fix function signature of create_menu() | expand

Commit Message

Khem Raj Aug. 30, 2022, 7:14 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../openthread/ot-br-posix/mbedtls.patch      | 43 +++++++++++++++++++
 .../openthread/ot-br-posix_git.bb             |  6 ++-
 .../openthread/ot-daemon/mbedtls.patch        | 43 +++++++++++++++++++
 .../openthread/ot-daemon_git.bb               |  1 +
 4 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/mbedtls.patch
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-daemon/mbedtls.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-connectivity/openthread/ot-br-posix/mbedtls.patch b/meta-networking/recipes-connectivity/openthread/ot-br-posix/mbedtls.patch
new file mode 100644
index 0000000000..91b3046484
--- /dev/null
+++ b/meta-networking/recipes-connectivity/openthread/ot-br-posix/mbedtls.patch
@@ -0,0 +1,43 @@ 
+mbedtls: Disable documentation warning as error with clang
+
+There are shortcomings with doxygen info which clang-15+ flags, dont
+treat them as errors
+
+Remove unused variable
+
+Fixes
+library/bignum.c:1395:29: error: variable 't' set but not used [-Werror,-Wunused-but-set-variable]
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/third_party/openthread/repo/third_party/mbedtls/repo/library/bignum.c
++++ b/third_party/openthread/repo/third_party/mbedtls/repo/library/bignum.c
+@@ -1544,7 +1544,7 @@ __attribute__ ((noinline))
+ #endif
+ void mpi_mul_hlp( size_t i, mbedtls_mpi_uint *s, mbedtls_mpi_uint *d, mbedtls_mpi_uint b )
+ {
+-    mbedtls_mpi_uint c = 0, t = 0;
++    mbedtls_mpi_uint c = 0;
+ 
+ #if defined(MULADDC_HUIT)
+     for( ; i >= 8; i -= 8 )
+@@ -1595,8 +1595,6 @@ void mpi_mul_hlp( size_t i, mbedtls_mpi_
+     }
+ #endif /* MULADDC_HUIT */
+ 
+-    t++;
+-
+     do {
+         *d += c; c = ( *d < c ); d++;
+     }
+--- a/third_party/openthread/repo/third_party/mbedtls/repo/CMakeLists.txt
++++ b/third_party/openthread/repo/third_party/mbedtls/repo/CMakeLists.txt
+@@ -192,7 +192,7 @@ if(CMAKE_COMPILER_IS_GNU)
+ endif(CMAKE_COMPILER_IS_GNU)
+ 
+ if(CMAKE_COMPILER_IS_CLANG)
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla")
++    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wno-error=documentation")
+     set(CMAKE_C_FLAGS_RELEASE     "-O2")
+     set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
+     set(CMAKE_C_FLAGS_COVERAGE    "-O0 -g3 --coverage")
diff --git a/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb b/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb
index a16b77849e..3d3c9bc0f2 100644
--- a/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb
+++ b/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb
@@ -17,14 +17,16 @@  PV = "0.3.0+git${SRCPV}"
 SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=main \
            file://0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch \
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
+           file://mbedtls.patch \
            "
 
 S = "${WORKDIR}/git"
 SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 inherit pkgconfig cmake systemd
-
-CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare"
+# openthread/repo/src/cli/cli.cpp:1786:18: fatal error: variable 'i' set but not used [-Wunused-but-set-variable]
+#    for (uint8_t i = 0;; i++)
+CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable"
 
 EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \
                  -DOTBR_DBUS=ON \
diff --git a/meta-networking/recipes-connectivity/openthread/ot-daemon/mbedtls.patch b/meta-networking/recipes-connectivity/openthread/ot-daemon/mbedtls.patch
new file mode 100644
index 0000000000..be26a20dad
--- /dev/null
+++ b/meta-networking/recipes-connectivity/openthread/ot-daemon/mbedtls.patch
@@ -0,0 +1,43 @@ 
+mbedtls: Disable documentation warning as error with clang
+
+There are shortcomings with doxygen info which clang-15+ flags, dont
+treat them as errors
+
+Remove unused variable
+
+Fixes
+library/bignum.c:1395:29: error: variable 't' set but not used [-Werror,-Wunused-but-set-variable]
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/third_party/mbedtls/repo/library/bignum.c
++++ b/third_party/mbedtls/repo/library/bignum.c
+@@ -1544,7 +1544,7 @@ __attribute__ ((noinline))
+ #endif
+ void mpi_mul_hlp( size_t i, mbedtls_mpi_uint *s, mbedtls_mpi_uint *d, mbedtls_mpi_uint b )
+ {
+-    mbedtls_mpi_uint c = 0, t = 0;
++    mbedtls_mpi_uint c = 0;
+ 
+ #if defined(MULADDC_HUIT)
+     for( ; i >= 8; i -= 8 )
+@@ -1595,8 +1595,6 @@ void mpi_mul_hlp( size_t i, mbedtls_mpi_
+     }
+ #endif /* MULADDC_HUIT */
+ 
+-    t++;
+-
+     do {
+         *d += c; c = ( *d < c ); d++;
+     }
+--- a/third_party/mbedtls/repo/CMakeLists.txt
++++ b/third_party/mbedtls/repo/CMakeLists.txt
+@@ -192,7 +192,7 @@ if(CMAKE_COMPILER_IS_GNU)
+ endif(CMAKE_COMPILER_IS_GNU)
+ 
+ if(CMAKE_COMPILER_IS_CLANG)
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla")
++    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wno-error=documentation")
+     set(CMAKE_C_FLAGS_RELEASE     "-O2")
+     set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
+     set(CMAKE_C_FLAGS_COVERAGE    "-O0 -g3 --coverage")
diff --git a/meta-networking/recipes-connectivity/openthread/ot-daemon_git.bb b/meta-networking/recipes-connectivity/openthread/ot-daemon_git.bb
index f3f4c70fa2..1063b5bd42 100644
--- a/meta-networking/recipes-connectivity/openthread/ot-daemon_git.bb
+++ b/meta-networking/recipes-connectivity/openthread/ot-daemon_git.bb
@@ -12,6 +12,7 @@  SRCREV = "7dfde1f12923f03c9680be4d838b94b7a2320324"
 PV = "0.1+git${SRCPV}"
 
 SRC_URI = "git://github.com/openthread/openthread.git;protocol=https;branch=main \
+           file://mbedtls.patch \
            "
 
 S = "${WORKDIR}/git"