Skip to content

Commit 66aa851

Browse files
Merge pull request #2109 from LAJW/lajw/free-lambda-from-cpplint-oppression
Remove curly brace CPP Lint checks
2 parents 7339638 + 18cab61 commit 66aa851

20 files changed

+68
-107
lines changed

CODING_STANDARD.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Formatting is enforced using clang-format. For more information about this, see
1919
- Nested function calls do not need to be broken up into separate lines
2020
even if the outer function call does.
2121
- If a method is bigger than 50 lines, break it into parts.
22-
- Put matching `{ }` into the same column.
22+
- Put matching `{ }` into the same column, except for initializer lists and
23+
lambdas, where you should place `{` directly after the closing `)`. This is
24+
to comply with clang-format, which doesn't support aligned curly braces in
25+
these cases.
2326
- Spaces around binary operators (`=`, `+`, `==` ...)
2427
- Space after comma (parameter lists, argument lists, ...)
2528
- Space after colon inside `for`

scripts/cpplint.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3972,14 +3972,6 @@ def CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error):
39723972
error(filename, linenum, 'whitespace/braces', 5,
39733973
'Missing space before {')
39743974

3975-
# Make sure '} else {' has spaces.
3976-
# if Search(r'}else', line):
3977-
# error(filename, linenum, 'whitespace/braces', 5,
3978-
# 'Missing space before else')
3979-
if (Search(r'^.*[^\s].*}$', line) or Search(r'^.*[^\s].*{$', line)) and not(Search(r'{[^}]*}', line)):
3980-
error(filename, linenum, 'whitespace/braces', 5,
3981-
'Put braces on a separate next line')
3982-
39833975
# You shouldn't have a space before a semicolon at the end of the line.
39843976
# There's a special case for "for" since the style guide allows space before
39853977
# the semicolon there.

src/goto-programs/goto_convert.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,10 +1823,8 @@ void goto_convertt::generate_ifthenelse(
18231823
// Note this depends on the fact that `instructions` is a std::list
18241824
// and so goto-program-destructive-append preserves iterator validity.
18251825
if(is_guarded_goto)
1826-
guarded_gotos.push_back({ // NOLINT(whitespace/braces)
1827-
tmp_v.instructions.begin(),
1828-
tmp_w.instructions.begin(),
1829-
guard});
1826+
guarded_gotos.push_back(
1827+
{tmp_v.instructions.begin(), tmp_w.instructions.begin(), guard});
18301828

18311829
dest.destructive_append(tmp_v);
18321830
dest.destructive_append(tmp_w);

src/goto-programs/lazy_goto_model.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ class lazy_goto_modelt : public abstract_goto_modelt
5353
message_handlert &message_handler)
5454
{
5555
return lazy_goto_modelt(
56-
[&handler, &options]
57-
(goto_model_functiont &fun, const abstract_goto_modelt &model) { // NOLINT(*)
56+
[&handler,
57+
&options](goto_model_functiont &fun, const abstract_goto_modelt &model) {
5858
handler.process_goto_function(fun, model, options);
5959
},
60-
[&handler, &options] (goto_modelt &goto_model) -> bool { // NOLINT(*)
60+
[&handler, &options](goto_modelt &goto_model) -> bool {
6161
return handler.process_goto_functions(goto_model, options);
6262
},
6363
message_handler);

src/goto-symex/symex_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ void goto_symext::symex_threaded_step(
166166
static goto_symext::get_goto_functiont get_function_from_goto_functions(
167167
const goto_functionst &goto_functions)
168168
{
169-
return [&goto_functions](const irep_idt &key) ->
170-
const goto_functionst::goto_functiont & { // NOLINT(*)
169+
return [&goto_functions](
170+
const irep_idt &key) -> const goto_functionst::goto_functiont & {
171171
return goto_functions.function_map.at(key);
172172
};
173173
}

src/java_bytecode/expr2java.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::string floating_point_to_java_string(float_type value)
6666
return class_name + ".POSITIVE_INFINITY";
6767
if(std::isinf(value) && value <= 0.)
6868
return class_name + ".NEGATIVE_INFINITY";
69-
const std::string decimal = [&]() -> std::string { // NOLINT
69+
const std::string decimal = [&]() -> std::string {
7070
// Using ostringstream instead of to_string to get string without
7171
// trailing zeros
7272
std::ostringstream raw_stream;
@@ -76,7 +76,7 @@ std::string floating_point_to_java_string(float_type value)
7676
return raw_decimal + ".0";
7777
return raw_decimal;
7878
}();
79-
const bool is_lossless = [&] { // NOLINT
79+
const bool is_lossless = [&] {
8080
if(value == std::numeric_limits<float_type>::min())
8181
return true;
8282
try
@@ -88,7 +88,7 @@ std::string floating_point_to_java_string(float_type value)
8888
return false;
8989
}
9090
}();
91-
const std::string lossless = [&]() -> std::string { // NOLINT
91+
const std::string lossless = [&]() -> std::string {
9292
if(is_lossless)
9393
return decimal;
9494
std::ostringstream stream;

src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,10 +895,8 @@ static void gather_symbol_live_ranges(
895895
if(e.id()==ID_symbol)
896896
{
897897
const auto &symexpr=to_symbol_expr(e);
898-
auto findit=
899-
result.insert({ // NOLINT(whitespace/braces)
900-
symexpr.get_identifier(),
901-
java_bytecode_convert_methodt::variablet()});
898+
auto findit = result.insert(
899+
{symexpr.get_identifier(), java_bytecode_convert_methodt::variablet()});
902900
auto &var=findit.first->second;
903901
if(findit.second)
904902
{

src/java_bytecode/java_bytecode_instrument.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class java_bytecode_instrumentt:public messaget
7575
optionalt<codet> instrument_expr(const exprt &expr);
7676
};
7777

78-
const std::vector<std::string> exception_needed_classes = { // NOLINT
78+
const std::vector<std::string> exception_needed_classes = {
7979
"java.lang.ArithmeticException",
8080
"java.lang.ArrayIndexOutOfBoundsException",
8181
"java.lang.ClassCastException",

src/java_bytecode/java_bytecode_language.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool java_bytecode_languaget::parse(
157157
{
158158
string_preprocess.initialize_known_type_table();
159159

160-
auto get_string_base_classes = [this](const irep_idt &id) { // NOLINT (*)
160+
auto get_string_base_classes = [this](const irep_idt &id) {
161161
return string_preprocess.get_string_type_base_classes(id);
162162
};
163163

src/java_bytecode/remove_exceptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void remove_exceptions(
572572
std::map<irep_idt, std::set<irep_idt>> exceptions_map;
573573
uncaught_exceptions(goto_functions, ns, exceptions_map);
574574
remove_exceptionst::function_may_throwt function_may_throw =
575-
[&exceptions_map](const irep_idt &id) { // NOLINT(whitespace/braces)
575+
[&exceptions_map](const irep_idt &id) {
576576
return !exceptions_map[id].empty();
577577
};
578578
remove_exceptionst remove_exceptions(

0 commit comments

Comments
 (0)