Skip to contentSkip to conversation

package/cpuload: fix build with gcc >= 14

PATCH In review Fabrice Fontaine 3 participants 3 messages Jul 20, 2024 – Aug 29, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/cpuload: fix build with gcc >= 14

Fix the following build failure with gcc >= 14:

read_cpu_stat.c: In function 'cpudata_new':
read_cpu_stat.c:49:17: error: implicit declaration of function 'error'; did you mean 'perror'? [-Wimplicit-function-declaration]

   49 |                 error("too many cpus");
      |                 ^~~~~
      |                 perror

Fixes:
- http://autobuild.buildroot.org/results/3bca2659011d123d7b7a0ca19c4e868643d45766

---
 .../0001-Changed-error-calls-to-perror.patch  | 115 ++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100644 package/cpuload/0001-Changed-error-calls-to-perror.patch
package/cpuload/0001-Changed-error-calls-to-perror.patch new file +115 -0
new file mode 100644
index 0000000000..6672bec677
@@ -0,0 +1,115 @@
+From ffd61eaa72acf123dea0c80ed3774656289ab49f Mon Sep 17 00:00:00 2001
+From: roiec <[email protected]>
+Date: Wed, 5 Jan 2022 17:12:05 +0200
+Subject: [PATCH] Changed 'error' calls to 'perror'
+
+Upstream: https://github.com/kelvincheung/cpuload/pull/1
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ .gitignore           | 60 ++++++++++++++++++++++++++++++++++++++++++++
+ src/graph_cpu_load.c |  4 +--
+ src/read_cpu_stat.c  |  2 +-
+ 3 files changed, 63 insertions(+), 3 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..c2ae907
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,60 @@
++# Prerequisites
++*.d
++
++# Object files
++*.o
++*.ko
++*.obj
++*.elf
++
++# Linker output
++*.ilk
++*.map
++*.exp
++
++# Precompiled Headers
++*.gch
++*.pch
++
++# Libraries
++*.lib
++*.a
++*.la
++*.lo
++
++# Shared objects (inc. Windows DLLs)
++*.dll
++*.so
++*.so.*
++*.dylib
++
++# Executables
++*.exe
++*.out
++*.app
++*.i*86
++*.x86_64
++*.hex
++
++# Debug files
++*.dSYM/
++*.su
++*.idb
++*.pdb
++
++# Kernel Module Compile Results
++*.mod*
++*.cmd
++.tmp_versions/
++modules.order
++Module.symvers
++Mkfile.old
++dkms.conf
++
++#images
++*.tgz
++*.img
++
++
++#build
++configure
+diff --git a/src/graph_cpu_load.c b/src/graph_cpu_load.c
+index e4b7785..525d9ed 100644
+--- a/src/graph_cpu_load.c
++++ b/src/graph_cpu_load.c
+@@ -132,7 +132,7 @@ void graph_new_line(char *str, unsigned long color)
+ 	graph_last_x = graph_last_y = -1;
+ 
+ 	if (graph_data_index >= MAX_GRAPH_DATA - 2)
+-		error("Too many graph data.");
++		perror("Too many graph data.");
+ 
+ 	graph_data[graph_data_index++] = DATUM_COLOR;
+ 	graph_data[graph_data_index++] = color;
+@@ -145,7 +145,7 @@ void graph_new_line(char *str, unsigned long color)
+ void graph_add_point(int size, int amount)
+ {
+ 	if (graph_data_index >= MAX_GRAPH_DATA - 4)
+-		error("Too many graph data.");
++		perror("Too many graph data.");
+ 
+ 	graph_data[graph_data_index++] = DATUM_SIZE;
+ 	graph_data[graph_data_index++] = size;
+diff --git a/src/read_cpu_stat.c b/src/read_cpu_stat.c
+index 3d014be..ff51d7f 100644
+--- a/src/read_cpu_stat.c
++++ b/src/read_cpu_stat.c
+@@ -46,7 +46,7 @@ ProcessList *cpudata_new(void)
+ 	fclose(file);
+ 
+ 	if (cpu > cpus -1) {
+-		error("too many cpus");
++		perror("too many cpus");
+ 		exit(1);
+ 	}
+ 
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 8 lines · On Sat, 20 Jul 2024 14:40:08 +0200 Fabrice Fontaine…

Fix the following build failure with gcc >= 14:

read_cpu_stat.c: In function 'cpudata_new':
read_cpu_stat.c:49:17: error: implicit declaration of function 'error'; did you mean 'perror'? [-Wimplicit-function-declaration]

   49 |                 error("too many cpus");
      |                 ^~~~~
      |                 perror
Quoted 8 lines

Fixes:
- http://autobuild.buildroot.org/results/3bca2659011d123d7b7a0ca19c4e868643d45766

---
 .../0001-Changed-error-calls-to-perror.patch  | 115 ++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100644 package/cpuload/0001-Changed-error-calls-to-perror.patch

The patch is a bit noisy with some changes to the .gitignore file that are clearly unrelated. But OK, that's the patch as it was submitted upstream, so fine.

Maybe you should react on the pull request, with a thumbs up or a positive comment, saying it also fixes problems we are seeing?

Thanks, patch applied!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Fabrice Fontaine
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Fix the following build failure with gcc >= 14:
read_cpu_stat.c: In function 'cpudata_new':
read_cpu_stat.c:49:17: error: implicit declaration of function 'error'; did you mean 'perror'? [-Wimplicit-function-declaration]

Quoted 8 lines
   49 |                 error("too many cpus");
      |                 ^~~~~
      |                 perror

Fixes:
- http://autobuild.buildroot.org/results/3bca2659011d123d7b7a0ca19c4e868643d45766

Committed to 2024.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot