diff mbox series

kernelshark: Make fontHeight() and stringWidth() static

Message ID 20200510111720.2e041431@oasis.local.home (mailing list archive)
State Accepted
Commit 127db5736e0ca708ed2e97a12f27569070eb2f74
Headers show
Series kernelshark: Make fontHeight() and stringWidth() static | expand

Commit Message

Steven Rostedt May 10, 2020, 3:17 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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.

Link: https://lore.kernel.org/linux-trace-devel/CADVatmN=Z0ASVXUBTyAu6F_TWoWiKiKsgm404rOx7Oh-a6LiQg@mail.gmail.com/

Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel-shark/src/KsUtils.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yordan Karadzhov May 11, 2020, 1:52 p.m. UTC | #1
On 10.05.20 г. 18:17 ч., Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> 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.
> 
> Link: https://lore.kernel.org/linux-trace-devel/CADVatmN=Z0ASVXUBTyAu6F_TWoWiKiKsgm404rOx7Oh-a6LiQg@mail.gmail.com/
> 
> Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Hi Sudip and Steven,

Thanks a lot for reporting and fixing the problem!
Yordan


Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>

> ---
>   kernel-shark/src/KsUtils.hpp | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel-shark/src/KsUtils.hpp b/kernel-shark/src/KsUtils.hpp
> index f44139bb..272a27d1 100644
> --- a/kernel-shark/src/KsUtils.hpp
> +++ b/kernel-shark/src/KsUtils.hpp
> @@ -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);
>
diff mbox series

Patch

diff --git a/kernel-shark/src/KsUtils.hpp b/kernel-shark/src/KsUtils.hpp
index f44139bb..272a27d1 100644
--- a/kernel-shark/src/KsUtils.hpp
+++ b/kernel-shark/src/KsUtils.hpp
@@ -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);