![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Functions | |
| _drop_unbuildable (flags) | |
| _in_repo (path) | |
| _relevant_flags (argv) | |
| _source_for (entry_file) | |
| build_flag_map (compdb='build/compile_commands.json') | |
| pkg_cflags () | |
| sources (args) | |
| _missing_unavailable_header (stderr) | |
| _unverifiable_with_full_flags (cmd, own, fmap, path) | |
| check (path, flags, fmap) | |
| main () | |
Variables | |
| REPO = os.getcwd() | |
| str | CC = 'x86_64-w64-mingw32-gcc' |
| str | CXX = 'x86_64-w64-mingw32-g++' |
| list | PKGS |
| UNAVAILABLE | |
| list | WIN_DEFINES |
| MISSING_HEADER = re.compile(r"fatal error: ([^:]+): No such file or directory") | |
| EXPLICIT_ERROR = re.compile(r'error: #error\s+"?([^"\n]+)') | |
| tuple | UNBUILDABLE_FEATURES |
Syntax-check translation units with the MinGW cross compiler.
Why: a clean Linux build cannot vouch for code inside `#ifdef _WIN32`, and it cannot
see the legacy macros `windows.h` defines (`near`, `grp2`, `interface`, ...). Every
cross-platform breakage in the darktable.h series was of that shape -- green locally,
broken on MinGW, and usually reported in a file that was not at fault. This runs the
real Windows toolchain over the tree so those are caught before CI, or when CI is
unavailable.
This is `-fsyntax-only`: it compiles nothing and links nothing. That is deliberate --
the goal is the preprocessor and the parser, which is where this class of bug lives.
Some libraries have no Fedora mingw64 package (json-glib, lensfun, libcurl, libraw,
osmgpsmap, openjpeg, sentry, OpenCL ...), so files needing them cannot be checked here.
They are reported as SKIPPED and counted separately, never as passing: a check you did
not run is not a check that succeeded. Keep UNAVAILABLE honest -- an entry for a library
that IS installed would downgrade a real failure to "skipped".
Setup (Fedora):
sudo dnf install mingw64-gcc mingw64-gcc-c++ mingw64-glib2 mingw64-gtk3 \
mingw64-lcms2 mingw64-sqlite mingw64-exiv2 mingw64-libpng \
mingw64-libtiff mingw64-libjpeg-turbo
Usage:
python3 tools/mingw_syntax_check.py # every .c/.cc under src/
python3 tools/mingw_syntax_check.py --changed master # only what a branch touched
python3 tools/mingw_syntax_check.py src/iop/lens.c # specific files
python3 tools/mingw_syntax_check.py --jobs 8
|
protected |
Definition at line 83 of file mingw_syntax_check.py.
Referenced by check().
|
protected |
Keep project include paths, drop the host toolchain's own -I/-isystem: those are Linux headers and must not leak into a MinGW cross check.
Definition at line 92 of file mingw_syntax_check.py.
Referenced by _relevant_flags().
|
protected |
The header name if this failure is only 'we do not have it cross-built'.
Definition at line 207 of file mingw_syntax_check.py.
Referenced by _unverifiable_with_full_flags().
|
protected |
The -D / -include / project -I flags from one compile command.
Definition at line 98 of file mingw_syntax_check.py.
References _in_repo().
Referenced by build_flag_map().
|
protected |
Map a compdb entry back to the source we care about. Generated introspection_X.c carries the flags for the src/iop/X.c it textually includes.
Definition at line 123 of file mingw_syntax_check.py.
Referenced by build_flag_map().
|
protected |
Dropping a feature define can hide declarations a feature-only file legitimately uses (src/libs/map_locations.c is entirely map code). Retry with the ORIGINAL flags: if it then dies on a header we do not have cross-built, the file is unverifiable here rather than broken.
Definition at line 220 of file mingw_syntax_check.py.
References _missing_unavailable_header().
Referenced by check().
| mingw_syntax_check.build_flag_map | ( | compdb = 'build/compile_commands.json' | ) |
Per-file -D/-include/project -I flags, taken from the BUILD SYSTEM. Guessing these is how a cross-check invents failures: the real build force-includes common/module_api.h and iop/iop_api.h into every module, and gates whole APIs behind -DHAVE_MAP / -DBUILD_PRINT / -DHAVE_OPENCL. Without them the harness reports missing declarations that exist perfectly well in the real build. Generated introspection_X.c entries carry the flags for src/iop/X.c, which is textually included by them, so they are mapped back onto the original.
Definition at line 136 of file mingw_syntax_check.py.
References _relevant_flags(), and _source_for().
Referenced by main().
| mingw_syntax_check.check | ( | path, | |
| flags, | |||
| fmap | |||
| ) |
Definition at line 236 of file mingw_syntax_check.py.
References _drop_unbuildable(), and _unverifiable_with_full_flags().
Referenced by main().
| mingw_syntax_check.main | ( | void | ) |
Definition at line 268 of file mingw_syntax_check.py.
References build_flag_map(), check(), main(), pkg_cflags(), and sources().
Referenced by main().
| mingw_syntax_check.pkg_cflags | ( | ) |
Definition at line 173 of file mingw_syntax_check.py.
Referenced by main().
| mingw_syntax_check.sources | ( | args | ) |
Definition at line 189 of file mingw_syntax_check.py.
Referenced by main().
| str mingw_syntax_check.CC = 'x86_64-w64-mingw32-gcc' |
Definition at line 39 of file mingw_syntax_check.py.
| str mingw_syntax_check.CXX = 'x86_64-w64-mingw32-g++' |
Definition at line 40 of file mingw_syntax_check.py.
Definition at line 68 of file mingw_syntax_check.py.
| mingw_syntax_check.MISSING_HEADER = re.compile(r"fatal error: ([^:]+): No such file or directory") |
Definition at line 62 of file mingw_syntax_check.py.
| list mingw_syntax_check.PKGS |
Definition at line 41 of file mingw_syntax_check.py.
| mingw_syntax_check.REPO = os.getcwd() |
Definition at line 38 of file mingw_syntax_check.py.
| mingw_syntax_check.UNAVAILABLE |
Definition at line 49 of file mingw_syntax_check.py.
| tuple mingw_syntax_check.UNBUILDABLE_FEATURES |
Definition at line 76 of file mingw_syntax_check.py.
| list mingw_syntax_check.WIN_DEFINES |
Definition at line 58 of file mingw_syntax_check.py.