diff options
author | Michele Calgaro <[email protected]> | 2022-12-04 19:16:43 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2022-12-04 19:38:30 +0900 |
commit | fdcd72088371b3d8dfd31f2a5159861ce0be5535 (patch) | |
tree | 06c160cc34157344f62b6c19af297858a0e57157 /debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/input/cpp/indent_shift.cpp | |
parent | a5d7db3b2c6171ea9e76b84155d2dfb66c243e5a (diff) | |
download | extra-dependencies-fdcd72088371b3d8dfd31f2a5159861ce0be5535.tar.gz extra-dependencies-fdcd72088371b3d8dfd31f2a5159861ce0be5535.zip |
uncrustify-trinity: updated based on upstream version 0.76.0
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/input/cpp/indent_shift.cpp')
-rw-r--r-- | debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/input/cpp/indent_shift.cpp | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/input/cpp/indent_shift.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/input/cpp/indent_shift.cpp new file mode 100644 index 00000000..54684fa7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/input/cpp/indent_shift.cpp @@ -0,0 +1,139 @@ +// We want simple 4-space indentation for each nesting "level". + +// cannot find a way to tell uncrustify to indent the line with parenthesis +int case2() { + + if (condition) { + // some code here + } + + std::out << + "hello " << "world " << + (who ? "and " : "or ") << + "all " << + "others" << ";" << std::endl; + + // and + + if (condition) { + // some code here + } + + std::out << + "hello " << "world " << + ("and ") << + "all " << + "others" << ";" << std::endl; + + if (cond) + std::out << "hi"; + +if (cond) +std::out +<< "hi" +<< "and" +<< "more" +; + +switch (var) { + case 0: +log() << 5 +<< 5; + break; +} + +#if 0 + out + << 5; +#endif + + return log + >> var + >> second + ; +} + + +// uncrustify aligns (with the << on the first line) instead of indenting +void case3() +{ + + if (condition1) { + + if (condition2) { + + std::out << "hello " + << "world " + << (who ? "and " : "or ") + << "all " + << "others" << ";" << std::endl; + + } + } + + // this often works better, but has problems with parentheses: + + if (condition1) { + if (condition2) { + std::out << "hello " << + "world " << + (who ? "and " : "or ") << + "all " << + "others" << ";" << std::endl; + } + } +} + +// uncrustify does not indent >> at all! +void case4() +{ + if (condition) { + // some code here + } + + std::in >> a + >> b + >> (who ? c : d) >> + >> e; + + // and + + if (condition1) { + + if (condition2) { + std::in >> a >> + b >> + (who ? c : d) >> + e; + } + } +} + +void foo() { + + if (head()) + os << "HEAD,"; + else + if (tail()) + os << "TAIL,"; + + if (a >= 0 && + b <= 0) + cerr << "it is"; +} + +int list[] = { + 1, +2, + 1 << 5, + 1 << 6 +}; + +void check() { + ostream &os = Comment(1) << "error: " << workerName << + " terminated by signal " << WTERMSIG(exitStatus); + + return theAddr.addrN().family() == AF_INET6 ? + (theAddr.octet(idx * 2) << 8) + theAddr.octet(idx * 2 + 1) : + theAddr.octet(idx); +} |