• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# How to successfully make changes to Ninja
2
3We're very wary of changes that increase the complexity of Ninja (in particular,
4new build file syntax or command-line flags) or increase the maintenance burden
5of Ninja. Ninja is already successfully used by hundreds of developers for large
6projects and it already achieves (most of) the goals we set out for it to do.
7It's probably best to discuss new feature ideas on the
8[mailing list](https://groups.google.com/forum/#!forum/ninja-build) or in an
9issue before creating a PR.
10
11## Coding guidelines
12
13Generally it's the
14[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) with
15a few additions:
16
17* Any code merged into the Ninja codebase which will be part of the main
18  executable must compile as C++03. You may use C++11 features in a test or an
19  unimportant tool if you guard your code with `#if __cplusplus >= 201103L`.
20* We have used `using namespace std;` a lot in the past. For new contributions,
21  please try to avoid relying on it and instead whenever possible use `std::`.
22  However, please do not change existing code simply to add `std::` unless your
23  contribution already needs to change that line of code anyway.
24* All source files should have the Google Inc. license header.
25* Use `///` for [Doxygen](http://www.doxygen.nl/) (use `\a` to refer to
26  arguments).
27* It's not necessary to document each argument, especially when they're
28  relatively self-evident (e.g. in
29  `CanonicalizePath(string* path, string* err)`, the arguments are hopefully
30  obvious).
31
32If you're unsure about code formatting, please use
33[clang-format](https://clang.llvm.org/docs/ClangFormat.html). However, please do
34not format code that is not otherwise part of your contribution.
35