diff mbox series

[meta-oe,4/4] directfb: Fix C++17 build warning

Message ID 20240826141644.78746-5-mark.jonas@de.bosch.com
State Accepted
Headers show
Series directfb: Do recipe maintenance | expand

Commit Message

Jonas Mark (BT-FS/ENG1-GRB) Aug. 26, 2024, 2:16 p.m. UTC
From: Ricardo Simoes <ricardo.simoes@pt.bosch.com>

DirectFB explicitly supports usage of C++. With C++17 and later the below
warning is given:

lib/direct/util.h:223:19:
warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  223 |      register int ret = 0;
      |                   ^~~

To address that, this commit brings in the patch proposed by PR which
removes the usage of the register keyword:

https://github.com/deniskropp/DirectFB/pull/25

Signed-off-by: Ricardo Simoes <ricardo.simoes@pt.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
---
 .../recipes-graphics/directfb/directfb.inc    |  1 +
 ...irect-remove-use-of-keyword-register.patch | 44 +++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 meta-oe/recipes-graphics/directfb/directfb/0001-libdirect-remove-use-of-keyword-register.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-graphics/directfb/directfb.inc b/meta-oe/recipes-graphics/directfb/directfb.inc
index 313c9d16f..59796cc65 100644
--- a/meta-oe/recipes-graphics/directfb/directfb.inc
+++ b/meta-oe/recipes-graphics/directfb/directfb.inc
@@ -25,6 +25,7 @@  SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/DirectFB-${PV}.tar.g
            file://0001-os-linux-Fix-build-when-__NR_futex-is-not-available.patch \
            file://0001-include-libgen.h-for-basename.patch \
            file://0001-inputdrivers-Correct-the-signature-of-bind-call-on-m.patch \
+           file://0001-libdirect-remove-use-of-keyword-register.patch \
            "
 
 S = "${WORKDIR}/DirectFB-${PV}"
diff --git a/meta-oe/recipes-graphics/directfb/directfb/0001-libdirect-remove-use-of-keyword-register.patch b/meta-oe/recipes-graphics/directfb/directfb/0001-libdirect-remove-use-of-keyword-register.patch
new file mode 100644
index 000000000..24d977f4d
--- /dev/null
+++ b/meta-oe/recipes-graphics/directfb/directfb/0001-libdirect-remove-use-of-keyword-register.patch
@@ -0,0 +1,44 @@ 
+From f6cdb9f1c3dbef8ef695703a2a5fb4e92b2dd8a0 Mon Sep 17 00:00:00 2001
+From: Simon Barth <simon.barth@gmx.de>
+Date: Mon, 5 Aug 2024 19:35:16 +0200
+Subject: [PATCH] libdirect: remove use of keyword 'register'
+
+The 'register' keyword was removed in C++17 and is now unused and
+reserved. When compiling code that uses DirecthFB with C++17,
+compilation fails.
+
+Since modern compilers likely don't produce different code whether the
+'register' keyword is used or not, there shouldn't be any performance
+impact introduced by this change.
+
+Signed-off-by: Simon Barth <simon.barth@gmx.de>
+
+Upstream-Status: Submitted [https://github.com/deniskropp/DirectFB/pull/25]
+---
+ lib/direct/util.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/direct/util.h b/lib/direct/util.h
+index 2109b6ca1..734645796 100644
+--- a/lib/direct/util.h
++++ b/lib/direct/util.h
+@@ -220,7 +220,7 @@ void DIRECT_API direct_md5_sum( void *dst, const void *src, const int len );
+ static __inline__ int
+ direct_util_count_bits( unsigned int mask )
+ {
+-     register int ret = 0;
++     int ret = 0;
+ 
+      while (mask) {
+           ret += mask & 1;
+@@ -325,7 +325,7 @@ D_ICEIL(float f)
+ static __inline__ int
+ direct_log2( int val )
+ {
+-     register int ret = 0;
++     int ret = 0;
+ 
+      while (val >> ++ret);
+ 
+-- 
+2.25.1