[llvm-bugs] [Bug 28851] New: Add a warning for using the same include guard in 2 different files
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 4 14:41:02 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28851
Bug ID: 28851
Summary: Add a warning for using the same include guard in 2
different files
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: rtrieu at google.com
Reporter: zturner at google.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Imagine the following scenario:
// foo.cpp
#include "foo.h"
// foo.h
#ifndef FOO_H
#define FOO_H
#include "bar.h"
#endif
// bar.h
#ifndef FOO_H
#define FOO_H
#endif
This happens occasionally as a result of copy-pasting one header file to
another header file to get the basic layout (header file premable, include
guards, namespace layout, etc) in place and then fixing up. But occasionally
one forgets to fix the header guard, leading to mysterious compiler errors.
It would be nice if this warned, by keeping for each translation unit a mapping
of hashed include guard to include file name, and if an entry is found that
exists in the hash table under a different filename, generating a warning.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160804/b748d63d/attachment.html>
More information about the llvm-bugs
mailing list