Skip to content

Commit 3726ace

Browse files
authored
format.yml: updated uncrustify to 0.80.1 (#7421)
1 parent 8e656e5 commit 3726ace

File tree

11 files changed

+56
-34
lines changed

11 files changed

+56
-34
lines changed

.github/workflows/format.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020

2121
runs-on: ubuntu-22.04
2222

23+
env:
24+
UNCRUSTIFY_VERSION: 0.80.1
25+
2326
steps:
2427
- uses: actions/checkout@v4
2528
with:
@@ -31,17 +34,19 @@ jobs:
3134
with:
3235
path: |
3336
~/uncrustify
34-
key: ${{ runner.os }}-uncrustify
37+
key: ${{ runner.os }}-uncrustify-${{ env.UNCRUSTIFY_VERSION }}
3538

3639
- name: build uncrustify
3740
if: steps.cache-uncrustify.outputs.cache-hit != 'true'
3841
run: |
39-
wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz
40-
tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0
41-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5
42+
set -x
43+
wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-${{ env.UNCRUSTIFY_VERSION }}.tar.gz
44+
tar xzvf uncrustify-${{ env.UNCRUSTIFY_VERSION }}.tar.gz
45+
cd uncrustify-uncrustify-${{ env.UNCRUSTIFY_VERSION }}
46+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
4247
cmake --build build -- -j$(nproc) -s
4348
mkdir ~/uncrustify
44-
cd build && cp uncrustify ~/uncrustify/
49+
cp build/uncrustify ~/uncrustify/
4550
4651
- name: Uncrustify check
4752
run: |

.uncrustify.cfg

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Uncrustify-0.72.0_f
1+
# Uncrustify-0.80.1_f
22

33
# The original size of tabs in the input.
44
#
@@ -133,14 +133,31 @@ indent_class = true # true/false
133133
# Default: 1
134134
indent_access_spec = -4 # number
135135

136-
# Whether to collapse empty blocks between '{' and '}'.
137-
# If true, overrides nl_inside_empty_func
136+
# Whether to collapse empty blocks between '{' and '}' except for functions.
137+
# Use nl_collapse_empty_body_functions to specify how empty function braces
138+
# should be formatted.
138139
nl_collapse_empty_body = true # true/false
139140

141+
# Whether to collapse empty blocks between '{' and '}' for functions only.
142+
# If true, overrides nl_inside_empty_func.
143+
nl_collapse_empty_body_functions = true # true/false
144+
140145
# Whether to convert all tabs to spaces in comments. If false, tabs in
141146
# comments are left alone, unless used for indenting.
142147
cmt_convert_tab_to_spaces = true # true/false
143148

149+
# An offset value that controls the indentation of the body of a multiline #define.
150+
# 'body' refers to all the lines of a multiline #define except the first line.
151+
# Requires 'pp_ignore_define_body = false'.
152+
#
153+
# <0: Absolute column: the body indentation starts off at the specified column
154+
# (ex. -3 ==> the body is indented starting from column 3)
155+
# >=0: Relative to the column of the '#' of '#define'
156+
# (ex. 3 ==> the body is indented starting 3 columns at the right of '#')
157+
#
158+
# Default: 8
159+
pp_multiline_define_body_indent = 4 # number
160+
144161
# The value might be used twice:
145162
# - at the assignment
146163
# - at the opening brace

lib/checkersreport.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ std::string CheckersReport::getReport(const std::string& criticalErrors) const
191191
const bool cppcheckPremium = isCppcheckPremium(mSettings);
192192

193193
auto reportSection = [&fout, cppcheckPremium]
194-
(const std::string& title,
195-
const Settings& settings,
196-
const std::set<std::string>& activeCheckers,
197-
const std::map<std::string, std::string>& premiumCheckers,
198-
const std::string& substring) {
194+
(const std::string& title,
195+
const Settings& settings,
196+
const std::set<std::string>& activeCheckers,
197+
const std::map<std::string, std::string>& premiumCheckers,
198+
const std::string& substring) {
199199
fout << std::endl << std::endl;
200200
fout << title << std::endl;
201201
fout << std::string(title.size(), '-') << std::endl;

lib/clangimport.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,12 +1502,12 @@ void clangimport::AstNode::createTokensForCXXRecord(TokenList &tokenList)
15021502
std::vector<AstNodePtr> children2;
15031503
std::copy_if(children.cbegin(), children.cend(), std::back_inserter(children2), [](const AstNodePtr& child) {
15041504
return child->nodeType == CXXConstructorDecl ||
1505-
child->nodeType == CXXDestructorDecl ||
1506-
child->nodeType == CXXMethodDecl ||
1507-
child->nodeType == FieldDecl ||
1508-
child->nodeType == VarDecl ||
1509-
child->nodeType == AccessSpecDecl ||
1510-
child->nodeType == TypedefDecl;
1505+
child->nodeType == CXXDestructorDecl ||
1506+
child->nodeType == CXXMethodDecl ||
1507+
child->nodeType == FieldDecl ||
1508+
child->nodeType == VarDecl ||
1509+
child->nodeType == AccessSpecDecl ||
1510+
child->nodeType == TypedefDecl;
15111511
});
15121512
Scope *scope = createScope(tokenList, isStruct ? ScopeType::eStruct : ScopeType::eClass, children2, classToken);
15131513
const std::string addr = mExtTokens[0];

lib/programmemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ static ValueFlow::Value evaluate(const std::string& op, const ValueFlow::Value&
669669
return result;
670670
}
671671

672-
using BuiltinLibraryFunction = std::function<ValueFlow::Value(const std::vector<ValueFlow::Value>&)>;
672+
using BuiltinLibraryFunction = std::function<ValueFlow::Value (const std::vector<ValueFlow::Value>&)>;
673673
static std::unordered_map<std::string, BuiltinLibraryFunction> createBuiltinLibraryFunctions()
674674
{
675675
std::unordered_map<std::string, BuiltinLibraryFunction> functions;

lib/symboldatabase.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5735,11 +5735,11 @@ static bool hasMatchingConstructor(const Scope* classScope, const ValueType* arg
57355735
return false;
57365736
const ValueType* vt = f.getArgumentVar(0)->valueType();
57375737
return vt &&
5738-
vt->type == argType->type &&
5739-
(argType->sign == ValueType::Sign::UNKNOWN_SIGN || vt->sign == argType->sign) &&
5740-
vt->pointer == argType->pointer &&
5741-
(vt->constness & 1) >= (argType->constness & 1) &&
5742-
(vt->volatileness & 1) >= (argType->volatileness & 1);
5738+
vt->type == argType->type &&
5739+
(argType->sign == ValueType::Sign::UNKNOWN_SIGN || vt->sign == argType->sign) &&
5740+
vt->pointer == argType->pointer &&
5741+
(vt->constness & 1) >= (argType->constness & 1) &&
5742+
(vt->volatileness & 1) >= (argType->volatileness & 1);
57435743
});
57445744
}
57455745

lib/token.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,7 @@ bool Token::hasKnownSymbolicValue(const Token* tok) const
25422542
return mImpl->mValues &&
25432543
std::any_of(mImpl->mValues->begin(), mImpl->mValues->end(), [&](const ValueFlow::Value& value) {
25442544
return value.isKnown() && value.isSymbolicValue() && value.tokvalue &&
2545-
value.tokvalue->exprId() == tok->exprId();
2545+
value.tokvalue->exprId() == tok->exprId();
25462546
});
25472547
}
25482548

@@ -2615,7 +2615,7 @@ const ValueFlow::Value* Token::getMovedValue() const
26152615
return nullptr;
26162616
const auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [](const ValueFlow::Value& value) {
26172617
return value.isMovedValue() && !value.isImpossible() &&
2618-
value.moveKind != ValueFlow::Value::MoveKind::NonMovedVariable;
2618+
value.moveKind != ValueFlow::Value::MoveKind::NonMovedVariable;
26192619
});
26202620
return it == mImpl->mValues->end() ? nullptr : &*it;
26212621
}

lib/token.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ class CPPCHECKLIB Token {
14281428
fIsInitBracket = (1ULL << 44), // Is this bracket used as a part of variable initialization i.e: int a{5}, b(2);
14291429
};
14301430

1431-
enum : std::uint8_t {
1431+
enum : std::uint8_t {
14321432
efMaxSize = sizeof(nonneg int) * 8,
14331433
efIsUnique = efMaxSize - 2,
14341434
};

lib/tokenize.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10852,10 +10852,10 @@ bool Tokenizer::hasIfdef(const Token *start, const Token *end) const
1085210852
const auto& directives = mDirectives;
1085310853
return std::any_of(directives.cbegin(), directives.cend(), [&](const Directive& d) {
1085410854
return startsWith(d.str, "#if") &&
10855-
d.linenr >= start->linenr() &&
10856-
d.linenr <= end->linenr() &&
10857-
start->fileIndex() < list.getFiles().size() &&
10858-
d.file == list.getFiles()[start->fileIndex()];
10855+
d.linenr >= start->linenr() &&
10856+
d.linenr <= end->linenr() &&
10857+
start->fileIndex() < list.getFiles().size() &&
10858+
d.file == list.getFiles()[start->fileIndex()];
1085910859
});
1086010860
}
1086110861

lib/valueflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2724,7 +2724,7 @@ static void valueFlowLifetimeFunction(Token *tok, const TokenList &tokenlist, Er
27242724
const Token* varTok = args[iArg - 1];
27252725
if (varTok->variable() && varTok->variable()->isLocal())
27262726
LifetimeStore{ varTok, "Passed to '" + tok->str() + "'.", ValueFlow::Value::LifetimeKind::Address }.byRef(
2727-
tok->next(), tokenlist, errorLogger, settings);
2727+
tok->next(), tokenlist, errorLogger, settings);
27282728
}
27292729
}
27302730
}

0 commit comments

Comments
 (0)