Created attachment 20764
The code for unsed-macros
Hi,
this example talks by itself:
------
/* In this example, the FUNC_NAME is used by the pre-processor, but not the code
* but is reported as "unused" by the compiler -Wunused-macro
*/
#pragma clang diagnostic warning "-Wunused-macros"
extern void foo(const char[]);
/*# define PetscRegisterFUNC_NAME() foo(FUNCT_NAME)*/
#define PetscRegisterFUNC_NAME()
#define FUNC_NAME "tata"
void tata() {
PetscRegisterFUNC_NAME();
}
------
clang -c t.c
t.c:12:9: warning: macro is not used [-Wunused-macros]
#define FUNC_NAME "tata"
So the FUNC_NAME macro is used in the pre-processing stage, but not the
compiling stage. Is it possible to tell to the -Wunused-macros to take pre-
processing into account?
Thanks,
Eric
t.c
(390 bytes, text/x-csrc)