Loading...
 
Skip to main content

System Workbench for STM32


Syntax error about __weak and __packed

The problem here is that the value of the symbol should NOT contain any quotes!

Every f***ing time I regenerate the sources of my project with CubeMX, I have to remove those quotes. They don't belong there and certainly result in invalid syntax (from the CDT Indexer point of view).

The quotes seem to be stripped when the compiler command is generated. So nobody seems to notice the error.

I reported this almost a year back. CDT's code indexer is still confused about the quotes in the symbols.

Eclipse shows a syntax error every time the __weak or __packed macros are used in ST's code. The indexer will not properly index the code due to the syntax errors. Searching for references and declarations and whatnot are not properly found, since CDT cannot parse the code due to the the syntax errors.

Open a project, take a look at the symbols, and observe that it says:

__weak="__attribute__((weak))"


So any declaration like

__weak void myFunction();

becomes

"__attribute__((weak))" void myFunction();


That's a syntax error. Those quotes don't belong there and should NOT be part of the symbol definition. This needs to be fixed. CDT cannot work properly with those quotes present.

Please fix it, or point me at the code that is involved in generating those quotes. I will fix it and send you a patch.