diff mbox series

[meta-oe,scarthgap] pcapplusplus: Fix build with gcc14

Message ID 20240530123501.2890879-1-akuster808@gmail.com
State New
Headers show
Series [meta-oe,scarthgap] pcapplusplus: Fix build with gcc14 | expand

Commit Message

akuster808 May 30, 2024, 12:35 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 .../0001-initialize-timespec-variable.patch   | 35 +++++++++++++++++++
 ...e-m_ExternalRawData-in-IDnsResource-.patch | 34 ++++++++++++++++++
 .../pcapplusplus/pcapplusplus_23.09.bb        |  5 ++-
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
 create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch

Comments

Martin Jansa May 30, 2024, 12:40 p.m. UTC | #1
Why is this needed in scarthgap? GCC upgrade won't be backported there
I believe and it doesn't have native/nativesdk to be useful on hosts
with gcc-14.

On Thu, May 30, 2024 at 2:35 PM Armin Kuster via
lists.openembedded.org <akuster808=gmail.com@lists.openembedded.org>
wrote:
>
> From: Khem Raj <raj.khem@gmail.com>
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Signed-off-by: Armin Kuster <akuster808@gmail.com>
> ---
>  .../0001-initialize-timespec-variable.patch   | 35 +++++++++++++++++++
>  ...e-m_ExternalRawData-in-IDnsResource-.patch | 34 ++++++++++++++++++
>  .../pcapplusplus/pcapplusplus_23.09.bb        |  5 ++-
>  3 files changed, 73 insertions(+), 1 deletion(-)
>  create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>  create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>
> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
> new file mode 100644
> index 0000000000..f2e210fc67
> --- /dev/null
> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
> @@ -0,0 +1,35 @@
> +From 298dec6f87061914c85049faca3d0ff3310d1794 Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Mon, 6 May 2024 12:15:30 -0700
> +Subject: [PATCH] initialize timespec variable
> +
> +Fixes build warnings with GCC14
> +
> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp: In constructor 'pcpp::RawPacket::RawPacket(const uint8_t*, int, timeval, bool, pcpp::LinkLayerType)':
> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
> +   23 |         timespec nsec_time;
> +      |                  ^~~~~~~~~
> +cc1plus: all warnings being treated as errors
> +
> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1389]
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + Packet++/src/RawPacket.cpp | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Packet++/src/RawPacket.cpp b/Packet++/src/RawPacket.cpp
> +index 8ad52d52..07dbbbe2 100644
> +--- a/Packet++/src/RawPacket.cpp
> ++++ b/Packet++/src/RawPacket.cpp
> +@@ -20,7 +20,7 @@ void RawPacket::init(bool deleteRawDataAtDestructor)
> +
> + RawPacket::RawPacket(const uint8_t* pRawData, int rawDataLen, timeval timestamp, bool deleteRawDataAtDestructor, LinkLayerType layerType)
> + {
> +-      timespec nsec_time;
> ++      timespec nsec_time = {};
> +       TIMEVAL_TO_TIMESPEC(&timestamp, &nsec_time);
> +       init(deleteRawDataAtDestructor);
> +       setRawData(pRawData, rawDataLen, nsec_time, layerType);
> +--
> +2.45.0
> +
> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
> new file mode 100644
> index 0000000000..b6389e0e3f
> --- /dev/null
> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
> @@ -0,0 +1,34 @@
> +From 742f564ee80749e9f1f3363092775545e37c0f87 Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Thu, 9 May 2024 17:02:09 -0700
> +Subject: [PATCH] packet++: Initialize m_ExternalRawData in IDnsResource
> + constructor
> +
> +Fixes following warning with GCC-14
> +
> +Packet++/src/DnsResource.cpp:29:24: error: '*this.pcpp::IDnsResource::m_ExternalRawData' may be used uninitialized [-Werror=maybe-uninitialized]
> +   29 |                 return m_ExternalRawData;
> +      |                        ^~~~~~~~~~~~~~~~~
> +
> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1391]
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + Packet++/src/DnsResource.cpp | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Packet++/src/DnsResource.cpp b/Packet++/src/DnsResource.cpp
> +index fec1bf05..c1f97041 100644
> +--- a/Packet++/src/DnsResource.cpp
> ++++ b/Packet++/src/DnsResource.cpp
> +@@ -10,7 +10,7 @@ namespace pcpp
> + {
> +
> + IDnsResource::IDnsResource(DnsLayer* dnsLayer, size_t offsetInLayer)
> +-      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr)
> ++      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr), m_ExternalRawData(nullptr)
> + {
> +       char decodedName[4096];
> +       m_NameLength = decodeName((const char*)getRawData(), decodedName);
> +--
> +2.45.0
> +
> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
> index 39c6942c83..9db0222172 100644
> --- a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
> @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
>
>  DEPENDS = "libpcap"
>
> -SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
> +SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master \
> +           file://0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch \
> +           file://0001-initialize-timespec-variable.patch"
> +
>  SRCREV = "4cf8ed44f9dd145f874dc1dd747dfefcfcab75be"
>
>  S = "${WORKDIR}/git"
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#110626): https://lists.openembedded.org/g/openembedded-devel/message/110626
> Mute This Topic: https://lists.openembedded.org/mt/106387290/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
akuster808 May 30, 2024, 3:55 p.m. UTC | #2
On 5/30/24 8:40 AM, Martin Jansa wrote:
> Why is this needed in scarthgap? GCC upgrade won't be backported there
> I believe and it doesn't have native/nativesdk to be useful on hosts
> with gcc-14.

My scarthgap build fails with the same error:

  /builds/stable/build/tmp/work/core2-32-poky-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
|    23 |         timespec nsec_time;
|       |                  ^~~~~~~~~
| cc1plus: all warnings being treated as errors

Pkg builds after patch is applied.  Should I add a note to this in the 
backport?

BR,
Armin

>
> On Thu, May 30, 2024 at 2:35 PM Armin Kuster via
> lists.openembedded.org <akuster808=gmail.com@lists.openembedded.org>
> wrote:
>> From: Khem Raj <raj.khem@gmail.com>
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> Signed-off-by: Armin Kuster <akuster808@gmail.com>
>> ---
>>   .../0001-initialize-timespec-variable.patch   | 35 +++++++++++++++++++
>>   ...e-m_ExternalRawData-in-IDnsResource-.patch | 34 ++++++++++++++++++
>>   .../pcapplusplus/pcapplusplus_23.09.bb        |  5 ++-
>>   3 files changed, 73 insertions(+), 1 deletion(-)
>>   create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>>   create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>>
>> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>> new file mode 100644
>> index 0000000000..f2e210fc67
>> --- /dev/null
>> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>> @@ -0,0 +1,35 @@
>> +From 298dec6f87061914c85049faca3d0ff3310d1794 Mon Sep 17 00:00:00 2001
>> +From: Khem Raj <raj.khem@gmail.com>
>> +Date: Mon, 6 May 2024 12:15:30 -0700
>> +Subject: [PATCH] initialize timespec variable
>> +
>> +Fixes build warnings with GCC14
>> +
>> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp: In constructor 'pcpp::RawPacket::RawPacket(const uint8_t*, int, timeval, bool, pcpp::LinkLayerType)':
>> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
>> +   23 |         timespec nsec_time;
>> +      |                  ^~~~~~~~~
>> +cc1plus: all warnings being treated as errors
>> +
>> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1389]
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> +---
>> + Packet++/src/RawPacket.cpp | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/Packet++/src/RawPacket.cpp b/Packet++/src/RawPacket.cpp
>> +index 8ad52d52..07dbbbe2 100644
>> +--- a/Packet++/src/RawPacket.cpp
>> ++++ b/Packet++/src/RawPacket.cpp
>> +@@ -20,7 +20,7 @@ void RawPacket::init(bool deleteRawDataAtDestructor)
>> +
>> + RawPacket::RawPacket(const uint8_t* pRawData, int rawDataLen, timeval timestamp, bool deleteRawDataAtDestructor, LinkLayerType layerType)
>> + {
>> +-      timespec nsec_time;
>> ++      timespec nsec_time = {};
>> +       TIMEVAL_TO_TIMESPEC(&timestamp, &nsec_time);
>> +       init(deleteRawDataAtDestructor);
>> +       setRawData(pRawData, rawDataLen, nsec_time, layerType);
>> +--
>> +2.45.0
>> +
>> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>> new file mode 100644
>> index 0000000000..b6389e0e3f
>> --- /dev/null
>> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>> @@ -0,0 +1,34 @@
>> +From 742f564ee80749e9f1f3363092775545e37c0f87 Mon Sep 17 00:00:00 2001
>> +From: Khem Raj <raj.khem@gmail.com>
>> +Date: Thu, 9 May 2024 17:02:09 -0700
>> +Subject: [PATCH] packet++: Initialize m_ExternalRawData in IDnsResource
>> + constructor
>> +
>> +Fixes following warning with GCC-14
>> +
>> +Packet++/src/DnsResource.cpp:29:24: error: '*this.pcpp::IDnsResource::m_ExternalRawData' may be used uninitialized [-Werror=maybe-uninitialized]
>> +   29 |                 return m_ExternalRawData;
>> +      |                        ^~~~~~~~~~~~~~~~~
>> +
>> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1391]
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> +---
>> + Packet++/src/DnsResource.cpp | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/Packet++/src/DnsResource.cpp b/Packet++/src/DnsResource.cpp
>> +index fec1bf05..c1f97041 100644
>> +--- a/Packet++/src/DnsResource.cpp
>> ++++ b/Packet++/src/DnsResource.cpp
>> +@@ -10,7 +10,7 @@ namespace pcpp
>> + {
>> +
>> + IDnsResource::IDnsResource(DnsLayer* dnsLayer, size_t offsetInLayer)
>> +-      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr)
>> ++      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr), m_ExternalRawData(nullptr)
>> + {
>> +       char decodedName[4096];
>> +       m_NameLength = decodeName((const char*)getRawData(), decodedName);
>> +--
>> +2.45.0
>> +
>> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
>> index 39c6942c83..9db0222172 100644
>> --- a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
>> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
>> @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
>>
>>   DEPENDS = "libpcap"
>>
>> -SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
>> +SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master \
>> +           file://0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch \
>> +           file://0001-initialize-timespec-variable.patch"
>> +
>>   SRCREV = "4cf8ed44f9dd145f874dc1dd747dfefcfcab75be"
>>
>>   S = "${WORKDIR}/git"
>> --
>> 2.34.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#110626): https://lists.openembedded.org/g/openembedded-devel/message/110626
>> Mute This Topic: https://lists.openembedded.org/mt/106387290/3617156
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Khem Raj May 30, 2024, 3:58 p.m. UTC | #3
On Thu, May 30, 2024 at 8:55 AM akuster808 <akuster808@gmail.com> wrote:
>
>
>
> On 5/30/24 8:40 AM, Martin Jansa wrote:
> > Why is this needed in scarthgap? GCC upgrade won't be backported there
> > I believe and it doesn't have native/nativesdk to be useful on hosts
> > with gcc-14.
>
> My scarthgap build fails with the same error:
>
>   /builds/stable/build/tmp/work/core2-32-poky-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
> |    23 |         timespec nsec_time;
> |       |                  ^~~~~~~~~
> | cc1plus: all warnings being treated as errors
>
> Pkg builds after patch is applied.  Should I add a note to this in the
> backport?

I think the preset for this fix was GCC-14 but this fix was general.
So backport is fine and perhaps adding context is ok too. Upto you.

>
> BR,
> Armin
>
> >
> > On Thu, May 30, 2024 at 2:35 PM Armin Kuster via
> > lists.openembedded.org <akuster808=gmail.com@lists.openembedded.org>
> > wrote:
> >> From: Khem Raj <raj.khem@gmail.com>
> >>
> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> Signed-off-by: Armin Kuster <akuster808@gmail.com>
> >> ---
> >>   .../0001-initialize-timespec-variable.patch   | 35 +++++++++++++++++++
> >>   ...e-m_ExternalRawData-in-IDnsResource-.patch | 34 ++++++++++++++++++
> >>   .../pcapplusplus/pcapplusplus_23.09.bb        |  5 ++-
> >>   3 files changed, 73 insertions(+), 1 deletion(-)
> >>   create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
> >>   create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
> >>
> >> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
> >> new file mode 100644
> >> index 0000000000..f2e210fc67
> >> --- /dev/null
> >> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
> >> @@ -0,0 +1,35 @@
> >> +From 298dec6f87061914c85049faca3d0ff3310d1794 Mon Sep 17 00:00:00 2001
> >> +From: Khem Raj <raj.khem@gmail.com>
> >> +Date: Mon, 6 May 2024 12:15:30 -0700
> >> +Subject: [PATCH] initialize timespec variable
> >> +
> >> +Fixes build warnings with GCC14
> >> +
> >> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp: In constructor 'pcpp::RawPacket::RawPacket(const uint8_t*, int, timeval, bool, pcpp::LinkLayerType)':
> >> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
> >> +   23 |         timespec nsec_time;
> >> +      |                  ^~~~~~~~~
> >> +cc1plus: all warnings being treated as errors
> >> +
> >> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1389]
> >> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> +---
> >> + Packet++/src/RawPacket.cpp | 2 +-
> >> + 1 file changed, 1 insertion(+), 1 deletion(-)
> >> +
> >> +diff --git a/Packet++/src/RawPacket.cpp b/Packet++/src/RawPacket.cpp
> >> +index 8ad52d52..07dbbbe2 100644
> >> +--- a/Packet++/src/RawPacket.cpp
> >> ++++ b/Packet++/src/RawPacket.cpp
> >> +@@ -20,7 +20,7 @@ void RawPacket::init(bool deleteRawDataAtDestructor)
> >> +
> >> + RawPacket::RawPacket(const uint8_t* pRawData, int rawDataLen, timeval timestamp, bool deleteRawDataAtDestructor, LinkLayerType layerType)
> >> + {
> >> +-      timespec nsec_time;
> >> ++      timespec nsec_time = {};
> >> +       TIMEVAL_TO_TIMESPEC(&timestamp, &nsec_time);
> >> +       init(deleteRawDataAtDestructor);
> >> +       setRawData(pRawData, rawDataLen, nsec_time, layerType);
> >> +--
> >> +2.45.0
> >> +
> >> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
> >> new file mode 100644
> >> index 0000000000..b6389e0e3f
> >> --- /dev/null
> >> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
> >> @@ -0,0 +1,34 @@
> >> +From 742f564ee80749e9f1f3363092775545e37c0f87 Mon Sep 17 00:00:00 2001
> >> +From: Khem Raj <raj.khem@gmail.com>
> >> +Date: Thu, 9 May 2024 17:02:09 -0700
> >> +Subject: [PATCH] packet++: Initialize m_ExternalRawData in IDnsResource
> >> + constructor
> >> +
> >> +Fixes following warning with GCC-14
> >> +
> >> +Packet++/src/DnsResource.cpp:29:24: error: '*this.pcpp::IDnsResource::m_ExternalRawData' may be used uninitialized [-Werror=maybe-uninitialized]
> >> +   29 |                 return m_ExternalRawData;
> >> +      |                        ^~~~~~~~~~~~~~~~~
> >> +
> >> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1391]
> >> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> +---
> >> + Packet++/src/DnsResource.cpp | 2 +-
> >> + 1 file changed, 1 insertion(+), 1 deletion(-)
> >> +
> >> +diff --git a/Packet++/src/DnsResource.cpp b/Packet++/src/DnsResource.cpp
> >> +index fec1bf05..c1f97041 100644
> >> +--- a/Packet++/src/DnsResource.cpp
> >> ++++ b/Packet++/src/DnsResource.cpp
> >> +@@ -10,7 +10,7 @@ namespace pcpp
> >> + {
> >> +
> >> + IDnsResource::IDnsResource(DnsLayer* dnsLayer, size_t offsetInLayer)
> >> +-      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr)
> >> ++      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr), m_ExternalRawData(nullptr)
> >> + {
> >> +       char decodedName[4096];
> >> +       m_NameLength = decodeName((const char*)getRawData(), decodedName);
> >> +--
> >> +2.45.0
> >> +
> >> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
> >> index 39c6942c83..9db0222172 100644
> >> --- a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
> >> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
> >> @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
> >>
> >>   DEPENDS = "libpcap"
> >>
> >> -SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
> >> +SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master \
> >> +           file://0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch \
> >> +           file://0001-initialize-timespec-variable.patch"
> >> +
> >>   SRCREV = "4cf8ed44f9dd145f874dc1dd747dfefcfcab75be"
> >>
> >>   S = "${WORKDIR}/git"
> >> --
> >> 2.34.1
> >>
> >>
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >> Links: You receive all messages sent to this group.
> >> View/Reply Online (#110626): https://lists.openembedded.org/g/openembedded-devel/message/110626
> >> Mute This Topic: https://lists.openembedded.org/mt/106387290/3617156
> >> Group Owner: openembedded-devel+owner@lists.openembedded.org
> >> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >>
>
akuster808 May 30, 2024, 4:27 p.m. UTC | #4
On 5/30/24 11:58 AM, Khem Raj wrote:
> On Thu, May 30, 2024 at 8:55 AM akuster808 <akuster808@gmail.com> wrote:
>>
>>
>> On 5/30/24 8:40 AM, Martin Jansa wrote:
>>> Why is this needed in scarthgap? GCC upgrade won't be backported there
>>> I believe and it doesn't have native/nativesdk to be useful on hosts
>>> with gcc-14.
>> My scarthgap build fails with the same error:
>>
>>    /builds/stable/build/tmp/work/core2-32-poky-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
>> |    23 |         timespec nsec_time;
>> |       |                  ^~~~~~~~~
>> | cc1plus: all warnings being treated as errors
>>
>> Pkg builds after patch is applied.  Should I add a note to this in the
>> backport?
> I think the preset for this fix was GCC-14 but this fix was general.
> So backport is fine and perhaps adding context is ok too. Upto you.

Context sounds good. thanks,

- armin
>> BR,
>> Armin
>>
>>> On Thu, May 30, 2024 at 2:35 PM Armin Kuster via
>>> lists.openembedded.org <akuster808=gmail.com@lists.openembedded.org>
>>> wrote:
>>>> From: Khem Raj <raj.khem@gmail.com>
>>>>
>>>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>>> Signed-off-by: Armin Kuster <akuster808@gmail.com>
>>>> ---
>>>>    .../0001-initialize-timespec-variable.patch   | 35 +++++++++++++++++++
>>>>    ...e-m_ExternalRawData-in-IDnsResource-.patch | 34 ++++++++++++++++++
>>>>    .../pcapplusplus/pcapplusplus_23.09.bb        |  5 ++-
>>>>    3 files changed, 73 insertions(+), 1 deletion(-)
>>>>    create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>>>>    create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>>>>
>>>> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>>>> new file mode 100644
>>>> index 0000000000..f2e210fc67
>>>> --- /dev/null
>>>> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
>>>> @@ -0,0 +1,35 @@
>>>> +From 298dec6f87061914c85049faca3d0ff3310d1794 Mon Sep 17 00:00:00 2001
>>>> +From: Khem Raj <raj.khem@gmail.com>
>>>> +Date: Mon, 6 May 2024 12:15:30 -0700
>>>> +Subject: [PATCH] initialize timespec variable
>>>> +
>>>> +Fixes build warnings with GCC14
>>>> +
>>>> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp: In constructor 'pcpp::RawPacket::RawPacket(const uint8_t*, int, timeval, bool, pcpp::LinkLayerType)':
>>>> +/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
>>>> +   23 |         timespec nsec_time;
>>>> +      |                  ^~~~~~~~~
>>>> +cc1plus: all warnings being treated as errors
>>>> +
>>>> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1389]
>>>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>>> +---
>>>> + Packet++/src/RawPacket.cpp | 2 +-
>>>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>>>> +
>>>> +diff --git a/Packet++/src/RawPacket.cpp b/Packet++/src/RawPacket.cpp
>>>> +index 8ad52d52..07dbbbe2 100644
>>>> +--- a/Packet++/src/RawPacket.cpp
>>>> ++++ b/Packet++/src/RawPacket.cpp
>>>> +@@ -20,7 +20,7 @@ void RawPacket::init(bool deleteRawDataAtDestructor)
>>>> +
>>>> + RawPacket::RawPacket(const uint8_t* pRawData, int rawDataLen, timeval timestamp, bool deleteRawDataAtDestructor, LinkLayerType layerType)
>>>> + {
>>>> +-      timespec nsec_time;
>>>> ++      timespec nsec_time = {};
>>>> +       TIMEVAL_TO_TIMESPEC(&timestamp, &nsec_time);
>>>> +       init(deleteRawDataAtDestructor);
>>>> +       setRawData(pRawData, rawDataLen, nsec_time, layerType);
>>>> +--
>>>> +2.45.0
>>>> +
>>>> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>>>> new file mode 100644
>>>> index 0000000000..b6389e0e3f
>>>> --- /dev/null
>>>> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
>>>> @@ -0,0 +1,34 @@
>>>> +From 742f564ee80749e9f1f3363092775545e37c0f87 Mon Sep 17 00:00:00 2001
>>>> +From: Khem Raj <raj.khem@gmail.com>
>>>> +Date: Thu, 9 May 2024 17:02:09 -0700
>>>> +Subject: [PATCH] packet++: Initialize m_ExternalRawData in IDnsResource
>>>> + constructor
>>>> +
>>>> +Fixes following warning with GCC-14
>>>> +
>>>> +Packet++/src/DnsResource.cpp:29:24: error: '*this.pcpp::IDnsResource::m_ExternalRawData' may be used uninitialized [-Werror=maybe-uninitialized]
>>>> +   29 |                 return m_ExternalRawData;
>>>> +      |                        ^~~~~~~~~~~~~~~~~
>>>> +
>>>> +Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1391]
>>>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>>> +---
>>>> + Packet++/src/DnsResource.cpp | 2 +-
>>>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>>>> +
>>>> +diff --git a/Packet++/src/DnsResource.cpp b/Packet++/src/DnsResource.cpp
>>>> +index fec1bf05..c1f97041 100644
>>>> +--- a/Packet++/src/DnsResource.cpp
>>>> ++++ b/Packet++/src/DnsResource.cpp
>>>> +@@ -10,7 +10,7 @@ namespace pcpp
>>>> + {
>>>> +
>>>> + IDnsResource::IDnsResource(DnsLayer* dnsLayer, size_t offsetInLayer)
>>>> +-      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr)
>>>> ++      : m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr), m_ExternalRawData(nullptr)
>>>> + {
>>>> +       char decodedName[4096];
>>>> +       m_NameLength = decodeName((const char*)getRawData(), decodedName);
>>>> +--
>>>> +2.45.0
>>>> +
>>>> diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
>>>> index 39c6942c83..9db0222172 100644
>>>> --- a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
>>>> +++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
>>>> @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
>>>>
>>>>    DEPENDS = "libpcap"
>>>>
>>>> -SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
>>>> +SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master \
>>>> +           file://0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch \
>>>> +           file://0001-initialize-timespec-variable.patch"
>>>> +
>>>>    SRCREV = "4cf8ed44f9dd145f874dc1dd747dfefcfcab75be"
>>>>
>>>>    S = "${WORKDIR}/git"
>>>> --
>>>> 2.34.1
>>>>
>>>>
>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>> Links: You receive all messages sent to this group.
>>>> View/Reply Online (#110626): https://lists.openembedded.org/g/openembedded-devel/message/110626
>>>> Mute This Topic: https://lists.openembedded.org/mt/106387290/3617156
>>>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>>
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
new file mode 100644
index 0000000000..f2e210fc67
--- /dev/null
+++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-initialize-timespec-variable.patch
@@ -0,0 +1,35 @@ 
+From 298dec6f87061914c85049faca3d0ff3310d1794 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 6 May 2024 12:15:30 -0700
+Subject: [PATCH] initialize timespec variable
+
+Fixes build warnings with GCC14
+
+/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp: In constructor 'pcpp::RawPacket::RawPacket(const uint8_t*, int, timeval, bool, pcpp::LinkLayerType)':
+/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/pcapplusplus/23.09/git/Packet++/src/RawPacket.cpp:23:18: error: 'nsec_time.timespec::<anonymous>' is used uninitialized [-Werror=uninitialized]
+   23 |         timespec nsec_time;
+      |                  ^~~~~~~~~
+cc1plus: all warnings being treated as errors
+
+Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1389]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Packet++/src/RawPacket.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Packet++/src/RawPacket.cpp b/Packet++/src/RawPacket.cpp
+index 8ad52d52..07dbbbe2 100644
+--- a/Packet++/src/RawPacket.cpp
++++ b/Packet++/src/RawPacket.cpp
+@@ -20,7 +20,7 @@ void RawPacket::init(bool deleteRawDataAtDestructor)
+ 
+ RawPacket::RawPacket(const uint8_t* pRawData, int rawDataLen, timeval timestamp, bool deleteRawDataAtDestructor, LinkLayerType layerType)
+ {
+-	timespec nsec_time;
++	timespec nsec_time = {};
+ 	TIMEVAL_TO_TIMESPEC(&timestamp, &nsec_time);
+ 	init(deleteRawDataAtDestructor);
+ 	setRawData(pRawData, rawDataLen, nsec_time, layerType);
+-- 
+2.45.0
+
diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
new file mode 100644
index 0000000000..b6389e0e3f
--- /dev/null
+++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch
@@ -0,0 +1,34 @@ 
+From 742f564ee80749e9f1f3363092775545e37c0f87 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 9 May 2024 17:02:09 -0700
+Subject: [PATCH] packet++: Initialize m_ExternalRawData in IDnsResource
+ constructor
+
+Fixes following warning with GCC-14
+
+Packet++/src/DnsResource.cpp:29:24: error: '*this.pcpp::IDnsResource::m_ExternalRawData' may be used uninitialized [-Werror=maybe-uninitialized]
+   29 |                 return m_ExternalRawData;
+      |                        ^~~~~~~~~~~~~~~~~
+
+Upstream-Status: Submitted [https://github.com/seladb/PcapPlusPlus/pull/1391]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Packet++/src/DnsResource.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Packet++/src/DnsResource.cpp b/Packet++/src/DnsResource.cpp
+index fec1bf05..c1f97041 100644
+--- a/Packet++/src/DnsResource.cpp
++++ b/Packet++/src/DnsResource.cpp
+@@ -10,7 +10,7 @@ namespace pcpp
+ {
+ 
+ IDnsResource::IDnsResource(DnsLayer* dnsLayer, size_t offsetInLayer)
+-	: m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr)
++	: m_DnsLayer(dnsLayer), m_OffsetInLayer(offsetInLayer), m_NextResource(nullptr), m_ExternalRawData(nullptr)
+ {
+ 	char decodedName[4096];
+ 	m_NameLength = decodeName((const char*)getRawData(), decodedName);
+-- 
+2.45.0
+
diff --git a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
index 39c6942c83..9db0222172 100644
--- a/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
+++ b/meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_23.09.bb
@@ -7,7 +7,10 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
 
 DEPENDS = "libpcap"
 
-SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
+SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master \
+           file://0001-packet-Initialize-m_ExternalRawData-in-IDnsResource-.patch \
+           file://0001-initialize-timespec-variable.patch"
+
 SRCREV = "4cf8ed44f9dd145f874dc1dd747dfefcfcab75be"
 
 S = "${WORKDIR}/git"