OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
cxx_errors Namespace Reference

Functions

 wrapper_text (source)
 cxx_compiler (c_compiler)
 module_of (path)
 real_source (entry)
 errors_of (entry, tmpdir, return_type=False)
 main ()

Variables

 ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 SRC = os.path.join(ROOT, 'src')
tuple C_ONLY

Detailed Description

Counts the C++ errors of each C source of a build, compiled the way COD2_CXX_DIRS compiles it.

    python3 scripts/cxx_errors.py <build_dir> [--module PC/qcommon ...] [--max 20] [--jobs N] [--return-type]

Reads <build_dir>/compile_commands.json, and compiles each C file of the
modules (paths relative to src/) as C++ inside extern "C" { #include "x.c" },
with the C++ compiler that matches the C one and the file's own flags. Prints
"<module>: <n> errors" and the first --max errors of each module. Exits with 0
when there are none.

--return-type looks only for non-void functions that can end without a return:
C allows it when the caller ignores the value, in C++ it is undefined and GCC
drops the code after the call. It compiles without -w and with -O1, because the
check needs the flow analysis.

Function Documentation

◆ cxx_compiler()

cxx_errors.cxx_compiler ( c_compiler)

◆ errors_of()

cxx_errors.errors_of ( entry,
tmpdir,
return_type = False )

◆ main()

cxx_errors.main ( )

◆ module_of()

cxx_errors.module_of ( path)

◆ real_source()

cxx_errors.real_source ( entry)
The C file of an entry: the file itself, or the one a cxx_wrap wrapper includes.

◆ wrapper_text()

cxx_errors.wrapper_text ( source)

Variable Documentation

◆ C_ONLY

tuple cxx_errors.C_ONLY
Initial value:
1= ('-Wno-error=implicit-function-declaration', '-Wno-error=implicit-int', '-Wno-error=int-conversion',
2 '-Wno-error=incompatible-pointer-types', '-Wno-error=return-mismatch', '-fcommon')

◆ ROOT

cxx_errors.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

◆ SRC

cxx_errors.SRC = os.path.join(ROOT, 'src')