Skip to contentSkip to conversation

kernelshark: Make fontHeight() and stringWidth() static

PATCH In review Steven Rostedt 2 participants 2 messages May 10, 2020 – May 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernelshark: Make fontHeight() and stringWidth() static

From: "Steven Rostedt (VMware)" <[email protected]>

Gcc 10 is much more picky about globals being defined in multiple objects even if they are the same function. The functions fontHeight() and stringWidth() are defined in a header file which places them in multiple objects. They need to be static otherwise gcc 10 will not be able to build.

---
 kernel-shark/src/KsUtils.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel-shark/src/KsUtils.hpp +2 -2
index f44139bb..272a27d1 100644
@@ -32,7 +32,7 @@
 
 //! @cond Doxygen_Suppress
 
-auto fontHeight = []()
+static auto fontHeight = []()
 {
 	QFont font;
 	QFontMetrics fm(font);
@@ -40,7 +40,7 @@ auto fontHeight = []()
 	return fm.height();
 };
 
-auto stringWidth = [](QString s)
+static auto stringWidth = [](QString s)
 {
 	QFont font;
 	QFontMetrics fm(font);
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

Gcc 10 is much more picky about globals being defined in multiple objects even if they are the same function. The functions fontHeight() and stringWidth() are defined in a header file which places them in multiple objects. They need to be static otherwise gcc 10 will not be able to build.

Hi Sudip and Steven,

Thanks a lot for reporting and fixing the problem! Yordan

Quoted 27 lines
---
  kernel-shark/src/KsUtils.hpp | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
kernel-shark/src/KsUtils.hpp +2 -2
index f44139bb..272a27d1 100644
@@ -32,7 +32,7 @@
 
  //! @cond Doxygen_Suppress
 
-auto fontHeight = []()
+static auto fontHeight = []()
  {
  	QFont font;
  	QFontMetrics fm(font);
@@ -40,7 +40,7 @@ auto fontHeight = []()
  	return fm.height();
  };
 
-auto stringWidth = [](QString s)
+static auto stringWidth = [](QString s)
  {
  	QFont font;
  	QFontMetrics fm(font);