Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
check_header_selfcontained Namespace Reference

Functions

 flags_from_database (build_dir)
 
 main ()
 

Variables

tuple X_MACRO_HEADERS
 
 ANSI = re.compile(r"\x1b\[[0-9;]*[A-Za-z]")
 
tuple SKIP_DIR_PARTS
 

Detailed Description

Check that every header compiles on its own.

A header should compile standalone. One that does not is relying on whoever includes
it having pulled something in first, which is the same defect as an unnecessary
include seen from the other side: the dependency is real, and written nowhere. It
breaks the day someone tidies an include in a file that never mentioned this header.

Each header is compiled as a translation unit containing nothing but an include of
itself, reusing the flags a real translation unit is built with, taken from
compile_commands.json. Only the syntax pass runs (-fsyntax-only), so no object code
is produced and the whole sweep is fast.

Headers that are NOT expected to stand alone are skipped, and the reason is recorded
rather than hidden:

  - X-macro headers, re-included several times in one translation unit with different
    macros defined, and expanded inside struct bodies. Compiling one alone is
    meaningless: it has no guard, by design.
  - Headers under a vendored or generated directory, which are not this project's to
    fix.

Usage:
  python3 tools/check_header_selfcontained.py -p build -o selfcontained.json [--jobs N]

Function Documentation

◆ flags_from_database()

check_header_selfcontained.flags_from_database (   build_dir)
Take the compile flags of a representative C translation unit.

Definition at line 55 of file check_header_selfcontained.py.

Referenced by main().

◆ main()

check_header_selfcontained.main ( void  )

Definition at line 102 of file check_header_selfcontained.py.

References flags_from_database(), main(), and max.

Referenced by main().

Variable Documentation

◆ ANSI

check_header_selfcontained.ANSI = re.compile(r"\x1b\[[0-9;]*[A-Za-z]")

Definition at line 49 of file check_header_selfcontained.py.

◆ SKIP_DIR_PARTS

tuple check_header_selfcontained.SKIP_DIR_PARTS
Initial value:
1= ("/external/", "/tests/integration/", "/doxygen-awesome-css/",
2 "/build/", "/CMakeFiles/")

Definition at line 51 of file check_header_selfcontained.py.

◆ X_MACRO_HEADERS

tuple check_header_selfcontained.X_MACRO_HEADERS
Initial value:
1= (
2 "common/module_api.h",
3 "views/view_api.h",
4 "libs/lib_api.h",
5 "imageio/format/imageio_format_api.h",
6 "imageio/storage/imageio_storage_api.h",
7 "iop/iop_api.h",
8)

Definition at line 40 of file check_header_selfcontained.py.