#include #include #include int main() { xmlDocPtr file = NULL; int status = 1; if (file) xmlFreeDoc(file); if (status) return 0; else return 1; } /* * Compiling this file with -Wall results in the following: * * $ gcc -Wall -I/usr/include/libxml2 mislead-xml.c -o mislead-xml -lxml2 * mislead-xml.c: In function ‘main’: * mislead-xml.c:10:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] * if (file) * ^~ * mislead-xml.c:13:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ * if (status) * ^~ * * Note it wouldn't be generated if: * * - 'xmlFreeDoc(file);' is in its own scope (surrounded by '{' and '}'). * - The 'if (status)' didn't start on the same column as the * 'xmlFreeDoc(file);' call. * - The 'if (status) .. else' block was in its own scope (surrounded by '{' * and '}'). * * The warning is absurd. */