cancel
Showing results for 
Search instead for 
Did you mean: 

Defining enum type compiles ok, but STM32CubeIDE flags syntax error

StevenG
Associate II

Defining the underlying type of an enumeration has been a difficult task until C23 added the feature.  Previously different compilers used different methods and results could vary unexpectedly.

 

As seen in the image below, STM32CubeIDE v 1.19.0 can recognize this C23 feature and flag mistakes, such as the out-of-range value 0x101 for the 8-bit enum.

StevenG_0-1760451686376.png

As seen in the gcc output below, the mistake is caught by gcc:

StevenG_1-1760451743024.png

This is all as it should be.  The problem is when I remove the fake out-of-range command, gcc works as expected but STM32CubeIDE flags a syntax error:

StevenG_2-1760451874411.png

The build finished with no errors or warnings so gcc 13 understands at least this part of the C23 standard.

StevenG_3-1760452017611.png

Is there a configuration within STM32CubeIDE to prevent displaying a Syntax error for code the compiler understands?

 

PS

  I checked the generated assembly and it appears that the correct 8-bit code (ldrb) is being generated:

StevenG_4-1760452219105.png

 

 

 

1 REPLY 1
Ghofrane GSOURI
ST Employee

Hello @StevenG 

First let me thank you for posting.

I'm currently checking this . I will get back to you asap.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.