Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion doc/manual.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,13 @@ paths, where a space would otherwise separate filenames. See below.)
`$:` :: a colon. (This is only necessary in `build` lines, where a colon
would otherwise terminate the list of outputs.)

`$^` :: a newline. Inserts '\n' ('\r\n' on Windows) into the resulting string.
`$^` :: a newline _(available since Ninja 1.14)_.

Inserts '\n' ('\r\n' on Windows) into the resulting string. This is useful to
write build commands that require several shell lines as a single `command`
value in the build plan.

Requires `ninja_required_version` to be specified in the build file.

`$$`:: a literal `$`.

Expand Down
2 changes: 1 addition & 1 deletion src/manifest_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool ManifestParser::Parse(const string& filename, const string& input,
// Check ninja_required_version immediately so we can exit
// before encountering any syntactic surprises.
if (name == "ninja_required_version")
CheckNinjaVersion(value, lexer_.manifest_version_major, lexer_.manifest_version_minor);
CheckNinjaVersion(value, &lexer_.manifest_version_major, &lexer_.manifest_version_minor);
env_->AddBinding(name, value);
break;
}
Expand Down
10 changes: 5 additions & 5 deletions src/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ void ParseVersion(const string& version, int* major, int* minor) {
}
}

void CheckNinjaVersion(const string& version, int &file_major, int &file_minor) {
void CheckNinjaVersion(const string& version, int *file_major, int *file_minor) {
int bin_major, bin_minor;
ParseVersion(kNinjaVersion, &bin_major, &bin_minor);
ParseVersion(version, &file_major, &file_minor);
ParseVersion(version, file_major, file_minor);

if (bin_major > file_major) {
if (bin_major > *file_major) {
Warning("ninja executable version (%s) greater than build file "
"ninja_required_version (%s); versions may be incompatible.",
kNinjaVersion, version.c_str());
return;
}

if ((bin_major == file_major && bin_minor < file_minor) ||
bin_major < file_major) {
if ((bin_major == *file_major && bin_minor < *file_minor) ||
bin_major < *file_major) {
Fatal("ninja version (%s) incompatible with build file "
"ninja_required_version version (%s).",
kNinjaVersion, version.c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void ParseVersion(const std::string& version, int* major, int* minor);

/// Check whether \a version is compatible with the current Ninja version,
/// aborting if not.
void CheckNinjaVersion(const std::string& required_version, int &file_major,
int &file_minor);
void CheckNinjaVersion(const std::string& required_version, int *file_major,
int *file_minor);

#endif // NINJA_VERSION_H_