1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 21:40:03 +00:00

Merge branch 'clang_format_fixes' into 'master'

Clang format fixes

See merge request OpenMW/openmw!2433
This commit is contained in:
psi29a 2022-09-25 18:42:11 +00:00
commit 0d225e14e3
5 changed files with 22 additions and 37 deletions

View File

@ -2,13 +2,13 @@
Language: Cpp Language: Cpp
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: false AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right AlignEscapedNewlines: Right
AlignOperands: false AlignOperands: false
AlignTrailingComments: false AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false
@ -83,7 +83,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60 PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left PointerAlignment: Left
ReflowComments: true ReflowComments: true
SortIncludes: true SortIncludes: CaseSensitive
SortUsingDeclarations: true SortUsingDeclarations: true
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true SpaceAfterTemplateKeyword: true

View File

@ -15,3 +15,5 @@
# Date: 9/22/2022 9:26:05 PM # Date: 9/22/2022 9:26:05 PM
# Apply clang-format to code base # Apply clang-format to code base
ddb0522bbf2aa8aa7c9e139ff7395fb8ed6a841f ddb0522bbf2aa8aa7c9e139ff7395fb8ed6a841f
88ec8a95231341e7962b85716510d414e9f0c424

View File

@ -1,33 +1,10 @@
#!/bin/bash #!/bin/bash -ex
set -o pipefail
CLANG_FORMAT="${CLANG_FORMAT:-clang-format}" CLANG_FORMAT="${CLANG_FORMAT:-clang-format}"
HAS_DIFFS=0 git ls-files |
grep -v '^extern/' |
check_format_file() { grep -P '\.(cpp|hpp|h)$' |
local item=$1 xargs -I '{}' -P $(nproc) bash -ec "\"${CLANG_FORMAT:?}\" --dry-run -Werror \"\${0:?}\" &> /dev/null || \"${CLANG_FORMAT:?}\" \"\${0:?}\" | git diff --color=always --no-index \"\${0:?}\" -" '{}' ||
"$CLANG_FORMAT" --dry-run -Werror "$item" &>/dev/null ( echo "clang-format differences detected"; exit -1 )
if [[ $? = 1 ]]; then
"${CLANG_FORMAT}" "${item}" | git diff --color=always --no-index "${item}" -
HAS_DIFFS=1
fi
}
check_format() {
local path=$1
find "$path" -type f -name "*" | while read item;
do
if [[ "$item" =~ .*\.(cpp|hpp|h) ]]; then
check_format_file "$item"
fi;
done;
}
check_format "./apps"
check_format "./components"
if [[ $HAS_DIFFS -eq 1 ]]; then
echo "clang-format differences detected"
exit 1
fi;
exit 0

View File

@ -56,7 +56,10 @@ namespace CSMWorld
/// Works like getAppendIndex unless an overloaded method uses the record pointer /// Works like getAppendIndex unless an overloaded method uses the record pointer
/// to get additional info about the record that results in an alternative index. /// to get additional info about the record that results in an alternative index.
int getAppendIndex (const std::string& id, UniversalId::Type type) const override { return getInsertIndex(id, type); } int getAppendIndex(const std::string& id, UniversalId::Type type) const override
{
return getInsertIndex(id, type);
}
bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override; bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override;
///< Reorder the rows [baseIndex, baseIndex+newOrder.size()) according to the indices ///< Reorder the rows [baseIndex, baseIndex+newOrder.size()) according to the indices

View File

@ -165,7 +165,10 @@ namespace Debug
CurrentDebugLevel = Verbose; CurrentDebugLevel = Verbose;
} }
virtual std::streamsize writeImpl(const char* str, std::streamsize size, Level debugLevel) { return size; } virtual std::streamsize writeImpl(const char* str, std::streamsize size, Level debugLevel)
{
return size;
}
}; };
#if defined _WIN32 && defined _DEBUG #if defined _WIN32 && defined _DEBUG