cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE incorrectly flags __attribute__((fallthrough)) as syntax error

Andrew Neil
Super User

I have

// Prevent a compiler warning on fall-through from one 'case' to another in
// a 'switch' statement
// https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
#define INTENTIONAL_FALLTHROUGH __attribute__((fallthrough))

 

But the IDE flags it as a syntax error:

AndrewNeil_0-1745942028203.png

and it's not just the macro:

AndrewNeil_1-1745942185891.png

 

The usage is correct according to GCC documentation:

https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Statement-Attributes.html

 

This is purely in the editor - the actual compiler gives 0 errors and 0 warnings.

IDE v1.13.1 on Win 11.

 

Seems to be a known Eclipse issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=567227

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
5 REPLIES 5
Ghofrane GSOURI
ST Employee

Hello @Andrew Neil 

Thanks for posting.

Please try to retest this issue using  the latest version of STM32CubeIDE 1.18.1.

I'will be waiting for your feedback.

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.

CTapp.1
Senior II

I'm seeing the same in 18.1.1:

CTapp1_0-1747230274097.png

(Not real code ;) )

Edited to add:

It looks like the parser doesn't like __attribute__ outside of a declaration, as this is "ok":

 

CTapp1_2-1747230509379.png

 


@CTapp.1 wrote:

I'm seeing the same in 18.1.1:


Thanks - that saves me installing 1.18.1 !

(I'm in the middle of a project using 1.13.1, and have no want or reason to change at this point)

 


@CTapp.1 wrote:

It looks like the parser doesn't like __attribute__ outside of a declaration


Confirmed that 1.13.1 does the same.

I guess the most usual use of __attribute__ is in declarations/definitions - the parser just doesn't handle this "special case"

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User

@CTapp.1 spotted a similar issue with static_assert() at file scope:

https://community.st.com/t5/stm32cubeide-mcus/cubeide-incorrectly-flags-syntax-error-on-static-assert-at-file/td-p/802577

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Hello @Andrew Neil @CTapp.1 

Thank you for bringing this issue to our attention.

A ticket has been escalated to dev team for further investigation.

Internal ticket number:209826

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.