This question has been asked before, but it seems none of the answers apply to my files. I'm using clangd 15.0.7 in VSCode on Windows 11 and macOS 13.2. Please note that gcc 11.3.0, the actual compiler for this project, doesn't emit any warnings. Here's the code :
minmax.h
#ifndef _KPPV_MATH_H_
#define _KPPV_MATH_H_
unsigned int min( unsigned int left, unsigned int right ); /* ISO C requires a translation unit to contain at least one declarationclang(-Wempty-translation-unit) */
unsigned int max( unsigned int left, unsigned int right );
#endif
minmax.c
#include "minmax.h"
unsigned int min( unsigned int left, unsigned int right ) {
return left < right ? left : right;
}
unsigned int max( unsigned int left, unsigned int right ) {
return left > right ? left : right;
}
.clangd
CompileFlags:
Add: [-W, -Wall, -pedantic, -xc, -std=c89, ]
Remove: [-Wempty-translation-unit]
( The Remove thing obviously doesn't work because of -pedantic -Wall
but I don't want people to suggest that, so I included it to show it doesn't work )