Commit Graph

2674 Commits

Author SHA1 Message Date
Jan Niklas Hasse
e87c49751e
Merge pull request #1868 from kadler/fix-aix-signal-checking
Handle process signalling correctly on AIX
2020-11-02 17:02:59 +01:00
Jan Niklas Hasse
0b5be1489a
Merge pull request #1834 from jhasse/close-during-generator
Close BuildLog while running generators, fix #1724
2020-11-02 17:02:40 +01:00
Kevin Adler
7ea6c537d2
Handle process signalling correctly on AIX
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
2020-10-31 01:02:37 -05:00
Jan Niklas Hasse
d45ff8ebf8 Check return value of setvbuf, fix #509 2020-10-30 10:02:35 +01:00
Jan Niklas Hasse
8323cf108f
Merge pull request #1865 from ThePrez/ibmi
build: Add IBM i compile/link flags
2020-10-30 09:29:28 +01:00
Jesse Gorzinski
e74884f026 fixup: remove unneeded CMAKE_C_FLAGS 2020-10-29 10:33:49 -05:00
Jesse Gorzinski
5203aa49ed build: Add IBM i compile/link flags 2020-10-29 10:00:47 -05:00
Jan Niklas Hasse
5993141c09
Merge pull request #1614 from splinter-build/std-namespace-for-headerfiles
Remove 'using namespace std' from header files, properly namespace all std symbols
2020-10-19 12:45:10 +02:00
Jan Niklas Hasse
08eb91637a
Merge pull request #1855 from splinter-build/add-sanitizers
Add debug build with sanitizers support, fix scan-build
2020-10-03 13:21:35 +02:00
Michael Jones
6fa1c59e02 Add debug build with sanitizers support 2020-10-02 12:46:03 -05:00
Jan Niklas Hasse
3dc8664859
Merge pull request #1852 from splinter-build/scan-build
Add clang-analyze to build
2020-10-02 18:44:42 +02:00
Jan Niklas Hasse
e14c2552e9 Revert "Merge pull request #1768 from jhasse/github-actions-lint"
This reverts commit 18df4d1e5d, reversing
changes made to 54959b0f2c.
2020-10-02 13:49:17 +02:00
Jan Niklas Hasse
18df4d1e5d
Merge pull request #1768 from jhasse/github-actions-lint
Run more CI tests on Ubuntu 20.04
2020-10-02 13:28:58 +02:00
Michael Jones
73e96c6aef Comply with project formatting rules wrt 80 column lines 2020-09-30 16:19:13 -05:00
Michael Jones
a5aae85a3c Remove 'using namespace std' from header files, properly namespace all std symbols 2020-09-30 16:19:11 -05:00
Michael Jones
c22512b9b5 Add clang-analyze to build 2020-09-30 13:17:21 -05:00
Michael Jones
ff4f2a0db2 Add 'using namespace std;' to all cc files to prepare for removing it from header files 2020-09-30 11:19:09 -05:00
Jan Niklas Hasse
3b8b83802f clang-tidy: Drop readability-container-size-empty due to tests 2020-09-19 11:02:53 +02:00
Jan Niklas Hasse
811b3d8876 GitHub Actions: Update to Ubuntu 20.04 2020-09-19 10:58:05 +02:00
Jan Niklas Hasse
a2464f923c Merge branch 'master' into github-actions-lint 2020-09-19 10:43:27 +02:00
David Callu
54959b0f2c
cmake: add BUILD_TESTING option (ON by default) (#1839)
option provided by cmake's Module CTest
enable_testing() is call by this Module
2020-09-14 12:39:13 +02:00
Jan Niklas Hasse
8cd857188e
Merge pull request #1789 from neheb/if
[clang-tidy] fix small false positive
2020-09-10 14:06:17 +02:00
Jan Niklas Hasse
04b6445907
Merge pull request #1786 from neheb/memb
[clang-tidy] remove redundant member init
2020-09-10 14:04:08 +02:00
Jan Niklas Hasse
2f3e5275e2
Merge pull request #1836 from aharrison24/cmake-browse-mode-support
CMake: Add support for "browse" mode
2020-08-28 15:11:44 +02:00
Alastair Harrison
0b5f5ba910 CMake: Add platform checks for browse mode support
Browse mode requires a number of POSIX features to be available.
This commit adds configure-time checks that the 'unistd.h' header is
available and that the `inline.sh` script executes successfully. If the
checks pass then browse mode is enabled.
2020-08-28 12:18:58 +01:00
Alastair Harrison
67f960be1b Improve error handling in inline.sh
Previously the script would generate some output and return a zero
error code, even if the calls to `od` or `sed` failed.

This change ensures that:
- If `od` or `sed` fail then the script will fail.
- Output will only be written on success.
2020-08-28 12:18:55 +01:00
Jan Niklas Hasse
727863bb0f
Merge pull request #1823 from serpent7776/patch-1
Use c++ instead of g++
2020-08-27 23:56:13 +02:00
Alastair Harrison
5b80abbc72 CMake: Add support for "browse" mode
Fixes ninja-build/ninja#1822, fixes ninja-build/ninja#1853

Adds support for `ninja -t browse` to CMake builds.

The platform support logic is copied from configure.py, so Windows,
Solaris and AIX are treated as 'unsupported' platforms. All other
platforms are assumed to be supported.

As discussed in #1853, when built via CMake the `ninja` executable
looks for a binary called `python` in the current path, in order to
launch the "browse" mode. The behaviour differs from that of the
configure.py script, which looks for a python executable that has the
*same name* as the python executable that invoked the configure script.
2020-08-27 21:50:35 +01:00
Jan Niklas Hasse
b0b26cc9c4 Close BuildLog while running generators, fix #1724
While #1780 delayed opening .ninja_log until the first write, this
this didn't fully fix the issue on Windows: There might be build
statements which run before the generator resulting in an actual write
to .ninja_log.

To fix this once and for all the BuildLog now gets closed before running
the generator. BuildLog::log_file_path_ won't be cleared so that it can
be opened again after the generator finished.
2020-08-26 12:12:30 +02:00
Jan Niklas Hasse
9ddd3c9177 Mark this 1.10.1.git 2020-08-18 21:24:50 +02:00
Jan Niklas Hasse
00968321d6
Merge pull request #1780 from jhasse/delay-open
Delay actually opening log files until the first write, fix #1724
2020-08-03 12:48:17 +02:00
Krzysztof Leśniak
6c5fc1d4ec
Use c++ instead of g++
`configure.py` assumes `g++` is present on the system, which is not the case, e.g. for FreeBSD.
`c++` should be used insted, which should be a link to system c++ compiler. This will be `g++` for linux, but `clang++` for FreeBSD.
2020-08-01 17:04:14 +02:00
David Callu
086a9b2f88 cmake: use PROJECT_{SOURCE,BINARY}_DIR instead of CMAKE_{SOURCE,BINARY}_DIR
CMAKE_SOURCE_DIR refer to the full path to the top level of the current
CMake source tree
PROJECT_SOURCE_DIR refer to the source directory of the last call to the
project() command made in the current directory scope or one of its parents

when ninja is use as a subproject, the build fail because of this.
2020-07-17 09:56:32 +02:00
Dimitris Apostolou
6c5e886aac Fix typos 2020-07-07 13:00:22 +02:00
Nico Weber
48a9fb5d0d
Merge pull request #1804 from ninja-build/nico-patch-2
Include sys/select.h in subprocess-posix.cc
2020-06-21 19:21:51 -04:00
Nico Weber
89984d5729
Merge pull request #1803 from ninja-build/nico-patch-1
Include unistd.h in disk_interface.cc
2020-06-21 19:21:14 -04:00
Nico Weber
b191404828
Include sys/select.h in subprocess-posix.cc
pselect() is in sys/select.h in "newer" (2001) versions of posix, so add an include for it.

While here, only include poll.h if USE_PPOLL is defined.
2020-06-21 18:37:46 -04:00
Nico Weber
580f57fe77
Include unistd.h in disk_interface.cc
stat() needs unistd.h in addition to sys/stat.h and sys/types.h per POSIX.
At least one (hobby) OS does need unistd.h, so add an include for it.
2020-06-21 18:32:02 -04:00
Rosen Penev
0ab46c5918
[clang-tidy] fix small false positive
else if has to be on the same line it seems.

Found with readability-misleading-indentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-17 17:27:26 -07:00
Rosen Penev
7e678b5d4d
[clang-tidy] remove redundant member init
Found with readability-redundant-member-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-17 17:25:54 -07:00
Jan Niklas Hasse
8948ec2de6 GitHub Actions: Switch to MSVC's subdirectory 2020-06-15 09:39:05 +02:00
Jan Niklas Hasse
86d30f775d
GitHub Actions: PowerShell requires \ instead of / 2020-06-15 09:26:20 +02:00
Jan Niklas Hasse
76ea0462a3
GitHub Actions: Run ninja_test directly (Windows) 2020-06-15 09:19:40 +02:00
Jan Niklas Hasse
aa6c4d88bd
Add more clang-tidy checks 2020-06-04 13:41:58 +02:00
Rosen Penev
be6c7afcd1
[clang-tidy] check empty instead of size (#1784)
Found with readability-container-size-empty

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-04 09:47:37 +02:00
Rosen Penev
a32a2087b6
[clang-tidy] remove pointless c_str() (#1785)
Found with readability-redundant-string-cstr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-04 09:46:43 +02:00
Jan Niklas Hasse
ea9f736100 Add missing Apache license header, fix #1781 2020-05-25 10:58:34 +02:00
Jan Niklas Hasse
cc79afbc05 Delay actually opening log files until the first write, fix #1724
Calling DepsLog/BuildLog::OpenForWrite will now only save the file path.
The actual opening of the file (moved to OpenForWriteIfNeeded) happens
right before the first write attempt.

This is needed so that the files aren't held open when the generator
runs (i.e. RebuildManifest) as it may call tools like recompact which
won't be able to open the file on Windows.

The disadvantage is that now the error reporting happens at a later time
and will be reported as a failed write, not a failed open.
2020-05-23 18:44:25 +02:00
zero9178
52649de2c5
bugfix: Process escaped colon in GCC depfiles. (#1774)
* Added ability to parse escaped colons in GCC Dep files enabling ninja to parse dep files of GCC 10 on Windows

* Added generated depfile_parser.cc

* Addressed formatting

* Added extra tests with real world examples of paths produced by both GCC 10 and Clang and GCC pre 10. Adjusted one test so it doesn't fail

* Adjusted regular expression to not match \: if the character following the : is either EOF or whitespace

* Fixed typo in regex (should be 0x20 for space not 0xa)

* Changed regular expression form using lookahead to instead matching a separate expression. This was needed as re2c pre version 1.17 is broken when using lookaheads. Also added tests for \: followed by whitespace

* Addressed formatting

* Forgot a missing std::

* Fixed formatting for spaces after , as well as respecting column width
2020-05-20 14:38:36 +02:00
Jan Niklas Hasse
2127dab42c GitHub Actions: Build and test both Debug and Release configs 2020-05-18 18:30:42 +02:00