Store the number of running edges instead of trying to compute it
from the started and finshed edge counts, which may be different
for starting and ending status messages. Allows removing the status
parameter to PrintStatus and the EdgeStatus enum.
The times that end up in the build log currently originate in the
status printer, and are propagated back out to the Builder. Move
the edge times into the Builder instead, and move the overall start
time into NinjaMain so it doesn't get reset during manifest
rebuilds.
Using this modern signature makes CMake/CTest use the effective
binary path and works also with multi-config generators which put
binaries in extra `Release` folders.
The randomly generated command strings are not null-terminated and
implicitly converted to StringPiece objects, which will use strlen to
determine how long the passed `char*` is. Without the null terminator,
this results in undefined behavior and regularly causes crashes on AIX.
Both hash_collision_bench and manifest_parser_perftest crash on AIX with
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
IOT/Abort trap (core dumped)
32-bit AIX applications by default allocates only a single 256M segment
for stack and heap for 32-bit applications, which is insufficient for
these tests. When building these tests on AIX in 32-bit mode, increase
the max number of segments so they will run without crashing.
* D9025: overriding '/GR' with '/GR-'
* C4100: 'argc': unreferenced formal parameter
* C4244: '=': conversion from 'int' to 'char', possible loss of data (on tolower)
* C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
* C4702: unreachable code (after Fatal)
* C4706: assignment within conditional expression
* C4996: 'strcpy': This function or variable may be unsafe
POSIX shells set the exit code to 128 + the signal number, which
coincidentally matches the layout used by the WIFSIGNALLED/WTERMSIG
macros on most Unix-like systems, but not on AIX. Instead, AIX stores
the signal value in the bottom 8 bits and also bits 16-23. The only time
ninja currently handles signals correctly is when the shell used to call
the program dies via signal.
To handle both scenarios, we detect the shell exit code format and
convert it to the format that the WIFSIGNALED/WTERMSIG macros expect.
Fixes#1623
Edges are nominally ordered by order in the build manifest, but in
fact are ordered by memory address. In most cases the memory address
will be monontonically increasing. Since serialized build output will
need unique IDs, add a monotonically increasing ID to edges, and use
that for sorting instead of memory address.