//
// -Winit-self
// Warn about variables that are initialized with themselves.
// Option can only be used together with -Wuninitialized.
//
// gcc -Wuninitialized -Winit-self init-self.c
//
#include <stdio.h>
int main() {
int i = i;
printf("i=%d\n", i);
}
//
// -Wshadow:
// Warn about local variables shadowing another variable.
//
// gcc -Wshadow shadow.c
#include <stdio.h>
int main() {
int i = 42;
if (i == 42) {
printf("i=%d\n", i);
int i = 49;
printf("i=%d\n", i);
}
}
//
// -Wundef:
// Warn if an undefined macro is evaluated
// in an #if construct.
//
#include <stdio.h>
int main() {
#if UNDEFINED_MACRO > 5
printf("UNDEFINED_MACRO is defined!!!\n");
#endif
printf("Hello world\n");
}
//
// -Wunreachable-code was supposed to warn if code was unreachable.
// It functionality, not the warning, had been removed:
//
// https://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html
//
#include <stdio.h>
void f() {
printf("unreachable");
}
int main() {
printf("1\n");
return 0;
printf("2\n");
}