Skip to main content
ferro
Lead
February 11, 2025
Solved

Gfx 4.24.1, C++20, warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]

  • February 11, 2025
  • 2 replies
  • 734 views

Dear Gfx Team,

When building Gfx in CubeIDE 1.17, C++20 compiler,

in file framework\include\platform\core\MCUInstrumentation.hpp ,

statement 'cc_consumed += cc_temp' causes this warning

../Middlewares/ST/touchgfx/framework/include/platform/core/MCUInstrumentation.hpp: In member function 'virtual void touchgfx::MCUInstrumentation::setMCUActive(bool)':
../Middlewares/ST/touchgfx/framework/include/platform/core/MCUInstrumentation.hpp:73:37: warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
 73 | cc_consumed += cc_temp;
 | ~~~~~~~~~~~~^~~~~~~~~~

If you could please change it to

cc_consumed = cc_consumed + cc_temp;

With this change the warning is no longer.

Thanks
Ferro

 

Best answer by Flemming Gram CHRISTENSEN

Thanks. We will change in a later release.

Remember you can also just change your copy. Either in the Middlewares folder or in your installation.

Pavel is also correct, but remember this code is C++98 :)

Thanks for comments.

 

 

2 replies

Pavel A.
February 12, 2025

This looks like misuse of volatile instead of atomic ((

 

Flemming Gram CHRISTENSEN
ST Employee
February 27, 2025

Thanks. We will change in a later release.

Remember you can also just change your copy. Either in the Middlewares folder or in your installation.

Pavel is also correct, but remember this code is C++98 :)

Thanks for comments.

 

 

ferro
ferroAuthor
Lead
February 27, 2025

"We will change in a later release."

Lovely. Thanks  @Flemming Gram CHRISTENSEN 

 

"you can also just change your copy"

I do. It is suboptimal.

 

"this code is C++98"

Old is gold. This is very interesting. It would be great to learn more about the TouchGfx/codebase history - why it still uses 'C++98, what aspects of the ecosystem hold Gfx back from adopting a newer standard, etc. Perhaps a 'Knowledge Base' article could cover this.