The attached patch adds a new warning that triggers on mismatched header
guards.  Typically, a header guard would look like:

#ifndef HEADER_NAME_
#define HEADER_NAME_

int foo = 42;

#endif

Occasionally, typos will cause the header guard to not function properly
but still compile, such as:

#ifndef HEADER_NAME_
#define HEDAER_NAME_

int foo = 42;

#endif

The two problem are:
1) The header may be developed and used while only being included once with
no problems.  Thus, it may take some time before the header guard
functionality is required.
2) When the header is included twice, the error is "redefinition of 'foo'"
which obscures the actual source of the problem.

Attachment: header-guard1.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to