I have definition of macro printerr
#define CLR_R "\x1b[1;31m"
#define CLR_N "\x1b[0m"
#define printerr(caller,msg) (caller==NULL)?printf(CLR_R "%s" CLR_N "\n",msg) \
: printf(CLR_R "%s:" CLR_N " %s\n",caller,msg)
And get warning
warning: reading through null pointer (argument 2), when calling
printerr(NULL,"error");.
How to suppress this warning?
#include <stdio.h>
#define printerr(caller,msg) (caller==NULL)?printf("%s\n",msg) : \
printf("%s: %s\n",caller,msg)
void main() {
printerr("Error","error occurred"); //will be ok
printerr(NULL,"error"); //Warning: is caller even checked here?
}
CLR_RandCLR_N#define CLR_R "\x1b[1;31m"#define CLR_N "\x1b[0m"