All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/lshw: fix build with gcc 4.8
@ 2022-08-13 20:20 Fabrice Fontaine
  2022-08-13 22:26 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-08-13 20:20 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Fix the following build failure with gcc 4.8 raised since commit
72a009fa98a37825624f70dc2a1cf825a5999a0a:

hw.cc: In member function 'long long int hw::value::asInteger() const':
hw.cc:2462:36: error: 'stoll' was not declared in this scope
       return stoll(This->s, NULL, 0);
                                    ^

Fixes:
 - http://autobuild.buildroot.org/results/162e438e3f9aab9310fdbc3cf7529144ce7cb50e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...-error-when-g-version-is-less-than-5.patch | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch

diff --git a/package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch b/package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch
new file mode 100644
index 0000000000..f15c8bc52c
--- /dev/null
+++ b/package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch
@@ -0,0 +1,65 @@
+From 383c80bf486f806438bb11a9c9a9567407cd47ab Mon Sep 17 00:00:00 2001
+From: "E.V.Acacia" <624758472@qq.com>
+Date: Fri, 3 Sep 2021 14:19:37 +0800
+Subject: [PATCH] solve: Compile error when gcc version is less than 5
+
+[Retrieved from:
+https://github.com/lyonel/lshw/pull/70/commits/383c80bf486f806438bb11a9c9a9567407cd47ab]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/core/cpuinfo.cc | 8 ++++----
+ src/core/hw.cc      | 2 +-
+ src/core/spd.cc     | 4 ++--
+ 3 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
+index 9e41a421..ed1c4164 100644
+--- a/src/core/cpuinfo.cc
++++ b/src/core/cpuinfo.cc
+@@ -465,13 +465,13 @@ string value)
+     if (id == "model name")
+       cpu->setProduct(value);
+     if (id == "microcode")
+-      cpu->setConfig(id, stoll(value, NULL, 0));
++      cpu->setConfig(id, strtoll(value.c_str(), NULL, 0));
+     if (id == "cpu family")
+-      cpu->addHint(id, stoll(value, NULL, 0));
++      cpu->addHint(id, strtoll(value.c_str(), NULL, 0));
+     if (id == "model")
+-      cpu->addHint(id, stoll(value, NULL, 0));
++      cpu->addHint(id, strtoll(value.c_str(), NULL, 0));
+     if (id == "stepping")
+-      cpu->addHint(id, stoll(value, NULL, 0));
++      cpu->addHint(id, strtoll(value.c_str(), NULL, 0));
+ 
+     family = cpu->getHint("cpu family");
+     model = cpu->getHint("model");
+diff --git a/src/core/hw.cc b/src/core/hw.cc
+index 1c1dad46..b266a863 100644
+--- a/src/core/hw.cc
++++ b/src/core/hw.cc
+@@ -2459,7 +2459,7 @@ long long value::asInteger() const
+   switch(This->type)
+   {
+     case hw::text:
+-      return stoll(This->s, NULL, 0);
++      return strtoll(This->s.c_str(), NULL, 0);
+     case hw::integer:
+       return This->ll;
+     case hw::boolean:
+diff --git a/src/core/spd.cc b/src/core/spd.cc
+index a304d061..2ad66b82 100644
+--- a/src/core/spd.cc
++++ b/src/core/spd.cc
+@@ -195,9 +195,9 @@ static bool scan_eeproms(hwNode & memory)
+   {
+     if (scan_eeprom(memory, namelist[i]->d_name))
+       current_bank++;
+-    free(namelist[i]);
++    delete(namelist[i]);
+   }
+-  free(namelist);
++  delete(namelist);
+ 
+   return true;
+ }
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/lshw: fix build with gcc 4.8
  2022-08-13 20:20 [Buildroot] [PATCH 1/1] package/lshw: fix build with gcc 4.8 Fabrice Fontaine
@ 2022-08-13 22:26 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2022-08-13 22:26 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

Fabrice, All,

On 2022-08-13 22:20 +0200, Fabrice Fontaine spake thusly:
> Fix the following build failure with gcc 4.8 raised since commit
> 72a009fa98a37825624f70dc2a1cf825a5999a0a:
> 
> hw.cc: In member function 'long long int hw::value::asInteger() const':
> hw.cc:2462:36: error: 'stoll' was not declared in this scope
>        return stoll(This->s, NULL, 0);
>                                     ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/162e438e3f9aab9310fdbc3cf7529144ce7cb50e
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  ...-error-when-g-version-is-less-than-5.patch | 65 +++++++++++++++++++
>  1 file changed, 65 insertions(+)
>  create mode 100644 package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch
> 
> diff --git a/package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch b/package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch
> new file mode 100644
> index 0000000000..f15c8bc52c
> --- /dev/null
> +++ b/package/lshw/0001-solve-Compile-error-when-g-version-is-less-than-5.patch
> @@ -0,0 +1,65 @@
> +From 383c80bf486f806438bb11a9c9a9567407cd47ab Mon Sep 17 00:00:00 2001
> +From: "E.V.Acacia" <624758472@qq.com>
> +Date: Fri, 3 Sep 2021 14:19:37 +0800
> +Subject: [PATCH] solve: Compile error when gcc version is less than 5
> +
> +[Retrieved from:
> +https://github.com/lyonel/lshw/pull/70/commits/383c80bf486f806438bb11a9c9a9567407cd47ab]
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + src/core/cpuinfo.cc | 8 ++++----
> + src/core/hw.cc      | 2 +-
> + src/core/spd.cc     | 4 ++--
> + 3 files changed, 7 insertions(+), 7 deletions(-)
> +
> +diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
> +index 9e41a421..ed1c4164 100644
> +--- a/src/core/cpuinfo.cc
> ++++ b/src/core/cpuinfo.cc
> +@@ -465,13 +465,13 @@ string value)
> +     if (id == "model name")
> +       cpu->setProduct(value);
> +     if (id == "microcode")
> +-      cpu->setConfig(id, stoll(value, NULL, 0));
> ++      cpu->setConfig(id, strtoll(value.c_str(), NULL, 0));
> +     if (id == "cpu family")
> +-      cpu->addHint(id, stoll(value, NULL, 0));
> ++      cpu->addHint(id, strtoll(value.c_str(), NULL, 0));
> +     if (id == "model")
> +-      cpu->addHint(id, stoll(value, NULL, 0));
> ++      cpu->addHint(id, strtoll(value.c_str(), NULL, 0));
> +     if (id == "stepping")
> +-      cpu->addHint(id, stoll(value, NULL, 0));
> ++      cpu->addHint(id, strtoll(value.c_str(), NULL, 0));
> + 
> +     family = cpu->getHint("cpu family");
> +     model = cpu->getHint("model");
> +diff --git a/src/core/hw.cc b/src/core/hw.cc
> +index 1c1dad46..b266a863 100644
> +--- a/src/core/hw.cc
> ++++ b/src/core/hw.cc
> +@@ -2459,7 +2459,7 @@ long long value::asInteger() const
> +   switch(This->type)
> +   {
> +     case hw::text:
> +-      return stoll(This->s, NULL, 0);
> ++      return strtoll(This->s.c_str(), NULL, 0);
> +     case hw::integer:
> +       return This->ll;
> +     case hw::boolean:
> +diff --git a/src/core/spd.cc b/src/core/spd.cc
> +index a304d061..2ad66b82 100644
> +--- a/src/core/spd.cc
> ++++ b/src/core/spd.cc
> +@@ -195,9 +195,9 @@ static bool scan_eeproms(hwNode & memory)
> +   {
> +     if (scan_eeprom(memory, namelist[i]->d_name))
> +       current_bank++;
> +-    free(namelist[i]);
> ++    delete(namelist[i]);
> +   }
> +-  free(namelist);
> ++  delete(namelist);
> + 
> +   return true;
> + }
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-13 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 20:20 [Buildroot] [PATCH 1/1] package/lshw: fix build with gcc 4.8 Fabrice Fontaine
2022-08-13 22:26 ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.