Query module AV Rule 35

name
Missing header guard
description
Header files should contain header guards (#defines to prevent the file from being included twice). This prevents errors and inefficiencies caused by repeated inclusion.
kind
problem
problem.severity
warning
precision
high
id
cpp/missing-header-guard
tags
efficiency maintainability modularity external/jsf

Imports

MultipleInclusion

Provides definitions related to include guards: techniques for preventing multiple inclusion of header files.

cpp

Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.

Predicates

defUndef

File f both defines and un-defines a macro called macroName.

extraDetail

Provides additional detail when there is an incorrect header guard. The second and third parameters are option typed, and are only present when there are additional links in the detail string.

hasXMacro

Header file hf looks like it contains an x-macro. That is, a macro that is used to interpret the data in hf, usually defined just before including that file and undefined immediately afterwards.

possibleGuard
usesMacro

Header file hf uses a macro called macroName.

Classes

Datatypes

TMaybePreprocessorDirective

Option type for preprocessor directives so we can produce a variable number of links in the result