Skip to content

Commit 466292a

Browse files
committed
Minor tidying to fit house style
`exit(1)` -> `exit(EXIT_FAILURE)` Branch and loop bodies are always enclosed in `{` `}` even when they contain a single line
1 parent 032cb73 commit 466292a

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

include/cpp2util.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,7 @@ class contract_group {
561561
std::cerr << ": " << msg;
562562
}
563563
std::cerr << "\n";
564-
// Get outta here but don't raise a signal
565-
std::exit(1);
564+
std::exit(EXIT_FAILURE);
566565
}
567566

568567
auto inline cpp2_default = contract_group(

source/io.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,9 @@ class braces_tracker
363363
}
364364

365365
auto found_preprocessor_else_was_there_another() -> bool {
366-
if (found_else)
366+
if (found_else) {
367367
return true;
368+
}
368369
found_else = true;
369370
return false;
370371
}

source/lex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,14 @@ auto lex_line(
718718
// the number of tokens has not gone down. So just push back as many
719719
// tokens as we merged. This will ensure that the token count remains
720720
// the same.
721-
for (auto i = 0; i < num_merged_tokens; i++)
721+
for (auto i = 0; i < num_merged_tokens; i++) {
722722
tokens.push_back({
723723
&generated_text.back()[0],
724724
std::ssize(generated_text.back()),
725725
pos,
726726
lexeme::Keyword
727727
});
728+
}
728729

729730
if (num_merged_tokens > 1)
730731
{

source/parse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9853,7 +9853,7 @@ class parser
98539853
curr().position(),
98549854
"invalid alias declaration - expected 'type', 'namespace', or a type-id after ':'"
98559855
);
9856-
return {};
9856+
return {};
98579857
}
98589858

98599859
// And the final ceremonial semicolon

source/sema.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,8 +2052,9 @@ class sema
20522052
}
20532053
auto stmt_decl = stmt->get_if<declaration_node>();
20542054
// If this is a declaration, check if it's a function
2055-
if (stmt_decl && stmt_decl->is_function())
2055+
if (stmt_decl && stmt_decl->is_function()) {
20562056
seen_function = true;
2057+
}
20572058

20582059
// If this is called 'this', then make sure we haven't seen any functions
20592060
if (

source/to_cpp1.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,9 @@ class positional_printer
468468
)
469469
{
470470
print_comment( comments[next_comment] );
471-
if (!print_remaining_comments)
471+
if (!print_remaining_comments) {
472472
assert(curr_pos.lineno <= pos.lineno); // we shouldn't have overshot
473+
}
473474
}
474475

475476
++next_comment;
@@ -481,8 +482,9 @@ class positional_printer
481482
}
482483
}
483484
// And catch up.
484-
while (curr_pos.lineno < pos.lineno)
485+
while (curr_pos.lineno < pos.lineno) {
485486
print("\n");
487+
}
486488
}
487489

488490
auto print_unprinted_comments()

0 commit comments

Comments
 (0)