Skip to content

Latest commit

 

History

History
74 lines (44 loc) · 3.61 KB

source_files.md

File metadata and controls

74 lines (44 loc) · 3.61 KB
  • Flag non-conventional file names.
  • Check that .h and .cpp (and equivalents) follow the rules below.

no enforcement

  • Check the positive list:

  • Alternative formulation: A .h file must contain only:

    • #includes of other .h files (possibly with include guards)
    • templates
    • class definitions
    • function declarations
    • extern declarations
    • inline function definitions
    • constexpr definitions
    • const definitions
    • using alias definitions

no enforcement

  • Flag declarations of entities in other source files not placed in a .h.

no enforcement

  • Easy.

clang-format can order includes
modularize area, since these header files are likely to be bad headers

  • Flag multiple using namespace directives for different namespaces in a single source file.

no enforcement

  • Flag using namespace at global scope in a header file.

no enforcement

  • Flag .h files without #include guards.

no enforcement

  • Flag all cycles.

no enforcement
Maybe IncludeWhatYouUse has something on it

  • Enforcement would require some knowledge about what in a header is meant to be "exported" to users and what is there to enable implementation. No really good solution is possible until we have modules.

modularize, IncludeWhatYouUse

  • Flag any use of an anonymous namespace in a header file.

no enforcement