syntax error but no compilation error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-28 2:27 PM
hello,
I have a syntax error on one line but no compilation error with stm32cubeide 1.14.1
HANDLE_busQuadSPI_CREATE(g_hbusQSPI_storage , &g_hqspi) ; //syntax error
HANDLE_busSPI_CREATE(g_hbusSPI3_interne , &g_hspi3); // no syntax error
with
#define HANDLE_busQuadSPI_CREATE(var, s) \
busQuadSPI_handle_t var = { .quadSpiHal = s, .mutex = NULL , .state = QSPI_STATE_Ndef }
and
#define HANDLE_busSPI_CREATE(var,s) \
busSPI_handle_t var = { .spiHal = s, .mutex = NULL , .state = SPI_STATE_Ndef }
if I don't use macro : no syntax error
busQuadSPI_handle_t g_hbusQSPI_storage = {.quadSpiHal = &g_hqspi , .mutex = NULL , .state = QSPI_STATE_Ndef } ;
HANDLE_busSPI_CREATE(g_hbusSPI3_interne , &g_hspi3);
what can happen?
Thanks in advance
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 7:09 AM
I tried launching the preprocessor with this
I had a lot of not explicit errors (something not configured I would say) but... Eclipse asked me if I wanted to update the "indexes"
I said yes and I no longer have the syntax error :victory_hand:
I still have to understand what these indexes are...
Thank you all for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-28 5:42 PM
What exactly is the compiler error output and at what line/column in your code.
It could also help you to output the source code after preprocessing (-E option for gcc).
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-28 7:18 PM
The IDE syntax checking is limited. It does its best but isn't going to be 100% accurate. This style of initialization is relatively new and isn't always supported, especially on embedded hardware.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 1:58 AM
Good morning.
There is no compilation error, just a syntax error in the editor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 2:04 AM
Macro HANDLE_busQuadSPI_CREATE and HANDLE_busSPI_CREATE are similar but only one syntax problem :thinking_face:, that's what I don't understand.
As the ide doesn't say what the problem is it's not very useful. Do you know if it is possible to deactivate these controls made by ide? What GCC say is probably quite sufficient, right?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 6:13 AM
Can you screenshot what you're calling an error? Hard to understand when there's no output. Can you hover over the "error" to get more info?
I'm sure error checking can be disabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 6:15 AM
If gcc compiles and links without errors (and ideally warnings), your code is okay. Sometimes the STM32CubeIDE shows issues in the Problems tab that I cannot understand either, so I safely ignore them (and switched to VS Code unless I need some advanced debugging features of the STM32CubeIDE).
The reason that you see only one syntax problem might simply be that the parser gives up after the first error detected because it couldn't recover from it.
Further analysis of your issue would require complete code, screenprints,.... But I think, nobody could or would fix it anyway :)
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 6:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 6:24 AM - edited ‎2024-01-29 6:27 AM
@TDK wrote:The IDE syntax checking is limited.
+1.
I've also seen this in other IDEs: the in-editor syntax checking is not done by the compiler, so it can "disagree".
@TDK wrote:This style of initialization is relatively new
I wonder if the IDE's checking has a configuration setting which needs changing to accommodate this style?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-29 6:28 AM
No errors or warnings during compilation
No messages in "Problems"
but an ugly thing on the code which calls out for nothing
I searched for a long time in the preferences to desable error checking but I couldn't find it.
