I used the clangd plugin of vscode with cmake to develop C language projects. The clangd plugin provides clang-tidy static detection function.
But I have a requirement: Can I ignore the errors in a certain file instead of warnings?
I have been working on it for a long time, and the answer I got is that I can only ignore warnings, not errors.
this is my setting.json config
"clangd.arguments": [
"--log=verbose",
"--compile-commands-dir=${workspaceFolder}/build",
"--query-driver=D:\000_soft\mingw\bin\",
],
Why is there such a requirement? Because I usually use vscode + clangd + cmake plug-in, but some embedded assembly syntax and compiler embedded macro definitions in the core_m4.h file of st are not supported by clangd, such as::
#if defined ( __CC_ARM )
#define __ASM __asm /*!< asm keyword for ARM Compiler */
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
#define __STATIC_INLINE static __inline
#elif defined ( __GNUC__ )
#define __ASM __asm /*!< asm keyword for GNU Compiler */
#define __INLINE inline /*!< inline keyword for GNU Compiler */
#define __STATIC_INLINE static inline
#elif defined ( __ICCARM__ )
#define __ASM __asm /*!< asm keyword for IAR Compiler */
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
#define __STATIC_INLINE static inline
#elif defined ( __TMS470__ )
#define __ASM __asm /*!< asm keyword for TI CCS Compiler */
#define __STATIC_INLINE static inline
#elif defined ( __TASKING__ )
#define __ASM __asm /*!< asm keyword for TASKING Compiler */
#define __INLINE inline /*!< inline keyword for TASKING Compiler */
#define __STATIC_INLINE static inline
#elif defined ( __CSMC__ )
#define __packed
#define __ASM _asm /*!< asm keyword for COSMIC Compiler */
#define __INLINE inline /*use -pc99 on compile line !< inline keyword for COSMIC Compiler */
#define __STATIC_INLINE static inline
#endif
__STATIC_INLINE void __set_CONTROL(uint32_t control)
{
register uint32_t __regControl __ASM("control");
__regControl = control;
}
5