Skip to main content
po221
Senior
January 28, 2024
Solved

syntax error but no compilation error

  • January 28, 2024
  • 2 replies
  • 7010 views

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

    Best answer by po221

    I tried launching the preprocessor with this

    https://community.st.com/t5/stm32cubeide-mcus/how-do-i-see-a-c-c-source-file-after-preprocessing-in/td-p/254677

    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

     

     

    2 replies

    KnarfB
    Super User
    January 29, 2024

    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

    po221
    po221Author
    Senior
    January 29, 2024

    Good morning.
    There is no compilation error, just a syntax error in the editor.

    TDK
    Super User
    January 29, 2024

    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.

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    po221
    po221Author
    Senior
    January 29, 2024

    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

    TDK
    Super User
    January 29, 2024

    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.

    "If you feel a post has answered your question, please click ""Accept as Solution""."