This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/42407] New: Detect non-unique header file names.


A potential source of error for C programmers is the inadvertent covering of
one header file by another with the same name.  This issue is documented by
CERT in the "CERT C Secure Coding Standard" as "PRE08-C. Guarantee that header
file names are unique
[https://www.securecoding.cert.org/confluence/display/seccode/PRE08-C.+Guarantee+that+header+file+names+are+unique].";
 The risk assessment for this issue is documented as:

"Failing to guarantee uniqueness of header files may result in the inclusion of
an older version of a header file, which may include incorrect macro
definitions or obsolete function prototypes or result in other errors that may
or may not be detected by the compiler. Portability issues may also stem from
the use of header names that are not guaranteed to be
unique[https://www.securecoding.cert.org/confluence/display/seccode/PRE08-C.+Guarantee+that+header+file+names+are+unique].";

To address this issue it would be a useful feature of the preprocessor to
generate a warning when an include directive specifies a header file name which
is non-unique within the active header search path.  This feature should be an
option for the user since implementations for detection of uniqueness would
likely incur a performance penalty.  It would also be useful to allow the user
to specify exceptions for the cases where covering one header with another is
intentional.

The addition of such a feature to the gcc preprocessor will help programmers
mediate the risk of CERT PRE08-C.


-- 
           Summary: Detect non-unique header file names.
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: don at drexel dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42407


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]