mirror of
https://github.com/transmission/transmission
synced 2025-01-02 21:16:04 +00:00
Use clang-format for qualifier alignment (#5845)
`QualifierAlignment` option is available since clang-format v14 and works better than our own script.
This commit is contained in:
parent
84f9d01e7d
commit
c14094f4c9
6 changed files with 6 additions and 20 deletions
|
@ -56,6 +56,7 @@ ConstructorInitializerIndentWidth: 4
|
||||||
FixNamespaceComments: true
|
FixNamespaceComments: true
|
||||||
IndentGotoLabels: false
|
IndentGotoLabels: false
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
QualifierAlignment: Right
|
||||||
SortUsingDeclarations: true
|
SortUsingDeclarations: true
|
||||||
SpaceAfterTemplateKeyword: false
|
SpaceAfterTemplateKeyword: false
|
||||||
StatementMacros:
|
StatementMacros:
|
||||||
|
@ -71,3 +72,4 @@ ObjCBlockIndentWidth: 4
|
||||||
ObjCBreakBeforeNestedBlockParam: false
|
ObjCBreakBeforeNestedBlockParam: false
|
||||||
ObjCSpaceBeforeProtocolList: false
|
ObjCSpaceBeforeProtocolList: false
|
||||||
PenaltyExcessCharacter: 1
|
PenaltyExcessCharacter: 1
|
||||||
|
QualifierAlignment: Right
|
||||||
|
|
|
@ -65,22 +65,6 @@ if ! find_cfiles -exec "${clang_format_exe}" $clang_format_args '{}' '+'; then
|
||||||
exitcode=1
|
exitcode=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# enforce east const
|
|
||||||
# look for 'const'
|
|
||||||
# - as the first token in the line
|
|
||||||
# - or preceded by 'static'
|
|
||||||
# - or following any of (<,;
|
|
||||||
# - but not if 'const' is followed by ` override` (const virtual function)
|
|
||||||
# - but not if 'const' is followed by ` = 0` (const virtual function)
|
|
||||||
matches="$(find_cfiles -exec perl -ne 'print "west const:",$ARGV,":",$_ if /((?:^|[(<,;]|\bstatic\s+)\s*)\b(const)\b(?!\s+((\w+\s*\[)|(override)|(\=\ 0)))/' '{}' '+')"
|
|
||||||
if [ -n "$matches" ]; then
|
|
||||||
echo "$matches"
|
|
||||||
exitcode=1
|
|
||||||
fi
|
|
||||||
if [ -n "$fix" ]; then
|
|
||||||
find_cfiles -exec perl -pi -e 's/((?:^|[(<,;]|\bstatic\s+)\s*)\b(const)\b(?!\s+((\w+\s*\[)|(override)|(\=\ 0)))/\1>\2</g' '{}' '+'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# format JS
|
# format JS
|
||||||
# but only if js has changed
|
# but only if js has changed
|
||||||
git diff --cached --quiet -- "web/**" && exit $exitcode
|
git diff --cached --quiet -- "web/**" && exit $exitcode
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
return ::dht_search(id, port, af, callback, closure);
|
return ::dht_search(id, port, af, callback, closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int init(int s, int s6, unsigned const char* id, unsigned const char* v)
|
virtual int init(int s, int s6, unsigned char const* id, unsigned char const* v)
|
||||||
{
|
{
|
||||||
return ::dht_init(s, s6, id, v);
|
return ::dht_init(s, s6, id, v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using value_type = Char;
|
using value_type = Char;
|
||||||
using const_reference = const Char&;
|
using const_reference = Char const&;
|
||||||
|
|
||||||
tr_strbuf()
|
tr_strbuf()
|
||||||
{
|
{
|
||||||
|
|
|
@ -509,7 +509,7 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile int status;
|
int volatile status;
|
||||||
tr_torrentSetLocation(self.fHandle, folder.UTF8String, YES, NULL, &status);
|
tr_torrentSetLocation(self.fHandle, folder.UTF8String, YES, NULL, &status);
|
||||||
|
|
||||||
while (status == TR_LOC_MOVING) //block while moving (for now)
|
while (status == TR_LOC_MOVING) //block while moving (for now)
|
||||||
|
|
|
@ -209,7 +209,7 @@ protected:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int init(int dht_socket, int dht_socket6, unsigned const char* id, unsigned const char* /*v*/) override
|
int init(int dht_socket, int dht_socket6, unsigned char const* id, unsigned char const* /*v*/) override
|
||||||
{
|
{
|
||||||
inited_ = true;
|
inited_ = true;
|
||||||
dht_socket_ = dht_socket;
|
dht_socket_ = dht_socket;
|
||||||
|
|
Loading…
Reference in a new issue