Menu

How suppress warning caused by macros defined in 3rd party library?

Yu
2024-08-30
2024-09-09
  • Yu

    Yu - 2024-08-30

    I'm working on an MCU firmwre project. Some pointer conversion is done in the library header file from chip vendor, such as

    "#define TIM1                ((TIM_TypeDef *) TIM1_BASE)",
    

    In my source file, calling function such as

    TIM_Cmd(TIM1, ENABLE);
    

    will cause a warning like "A conversion should not be performed between a pointer to object and an integer type"

    Since the conversion happens in the library header file, there's no way to fix it. I already suppressed the warnings of library sources by providing a suppressions_list.txt as below:

    *:${CMAKE_CURRENT_SOURCE_DIR}/mcu/*.*
    *:${CMAKE_CURRENT_SOURCE_DIR}/lib/*.*
    

    How can I suppress the warning without suppressing all warnings of this type globally? Thank you!

     
  • Daniel Marjamäki

    hmm I am thinking that we could try to warn about the macro instead. You will get a warning in the header instead.

    How is TIM_TypeDef and TIM1_BASE defined?

     
    • Daniel Marjamäki

      ping could we get some feedback?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.