Skip to main content
ferro
Lead
January 7, 2025
Solved

Gfx 4.24.1, warning in CWRUtil::toQ5(T) [with T = float]

  • January 7, 2025
  • 2 replies
  • 1501 views

Dear Gfx Team,

CWRUtil::toQ5 causes Cube compiler giving this warning

c:\TouchGFX\4.24.1\touchgfx\framework\include\touchgfx\widgets\canvas\CWRUtil.hpp

 

../touchgfx/widgets/canvas/CWRUtil.hpp: In instantiation of 'static touchgfx::CWRUtil::Q5 touchgfx::CWRUtil::toQ5(T) [with T = float]':
../touchgfx/widgets/canvas/Canvas.hpp:120:36: required from here
../touchgfx/widgets/canvas/CWRUtil.hpp:518:31: warning: arithmetic between floating-point type 'float' and enumeration type 'touchgfx::Rasterizer::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
 518 | return Q5((int)(value * Rasterizer::POLY_BASE_SIZE));
 | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

Could you possibly cast Rasterizer::POLY_BASE_SIZE to the static_cast<T> :

 

static Q5 toQ5(T value)
{
 return Q5(static_cast<int>(value * static_cast<T>(Rasterizer::POLY_BASE_SIZE)));
}

 

 

ferro_0-1736248095880.png

 

What do you think ?

 

This topic has been closed for replies.
Best answer by GaetanGodart

Hello @ferro ,

 

Thank you for your feedback!
I will report it to the team and I will keep you updated.

I am personally unaware of this function, can you tell me in which file it is located?

 

Regards,

2 replies

GaetanGodart
GaetanGodartBest answer
ST Employee
January 7, 2025

Hello @ferro ,

 

Thank you for your feedback!
I will report it to the team and I will keep you updated.

I am personally unaware of this function, can you tell me in which file it is located?

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
ferro
ferroAuthor
Lead
January 7, 2025

Hi @GaetanGodart 

"can you tell me in which file it is located?"

c:\TouchGFX\4.24.1\touchgfx\framework\include\touchgfx\widgets\canvas\CWRUtil.hpp

 

GaetanGodart
ST Employee
January 7, 2025

Thank you @ferro !

Gaetan GodartSoftware engineer at ST (TouchGFX)
GaetanGodart
ST Employee
February 3, 2025

Hello @ferro ,

 

It seems we have implemented the change.
It should be available now or in the next release coming soon.

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
ferro
ferroAuthor
Lead
February 5, 2025

Lovely. MSVC C++17 does not complain but MSVC and CubeIDE C++20 does so nice its sorted @GaetanGodart .