Fix check-style #9161

This commit is contained in:
Alexey Milovidov 2020-02-17 22:09:56 +03:00
parent 146109fe27
commit c76ff369bb
6 changed files with 33 additions and 31 deletions

View File

@ -58,9 +58,9 @@ uint64_t getMemoryAmountOrZero()
#endif
uint64_t size = 0; /* 64-bit */
size_t len = sizeof(size);
if ( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 ) {
if (sysctl(mib, 2, &size, &len, NULL, 0) == 0)
return size;
}
return 0; /* Failed? */
#elif defined(_SC_AIX_REALMEM)
@ -88,9 +88,9 @@ uint64_t getMemoryAmountOrZero()
#endif
unsigned int size = 0; /* 32-bit */
size_t len = sizeof(size);
if ( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 ) {
if (sysctl(mib, 2, &size, &len, NULL, 0) == 0)
return size;
}
return 0; /* Failed? */
#endif /* sysctl and sysconf variants */

View File

@ -2,7 +2,8 @@
#include <memory>
namespace ext {
namespace ext
{
template <class T>
class Singleton

View File

@ -13,21 +13,22 @@
# and then to run formatter only for the specified files.
ROOT_PATH=$(git rev-parse --show-toplevel)
EXCLUDE_DIRS='build/|integration/|widechar_width/|glibc-compatibility/|memcpy/|consistent-hashing'
find $ROOT_PATH/dbms -name '*.h' -or -name '*.cpp' |
grep -vP 'Compiler|build' |
find $ROOT_PATH/{dbms,base} -name '*.h' -or -name '*.cpp' 2>/dev/null |
grep -vP $EXCLUDE_DIRS |
xargs grep $@ -P '((class|struct|namespace|enum|if|for|while|else|throw|switch).*|\)(\s*const)?(\s*override)?\s*)\{$|\s$|\t|^ {1,3}[^\* ]\S|\t|^\s*(if|else if|if constexpr|else if constexpr|for|while|catch|switch)\(|\( [^\s\\]|\S \)' |
# a curly brace not in a new line, but not for the case of C++11 init or agg. initialization | trailing whitespace | number of ws not a multiple of 4, but not in the case of comment continuation | a tab character | missing whitespace after for/if/while... before opening brace | whitespaces inside braces
grep -v -P '(//|:\s+\*|\$\(\()| \)"'
# single-line comment | continuation of a multiline comment | a typical piece of embedded shell code | something like ending of raw string literal
# // namespace comments are unneeded
find $ROOT_PATH/dbms -name '*.h' -or -name '*.cpp' |
grep -vP 'Compiler|build' |
find $ROOT_PATH/{dbms,base} -name '*.h' -or -name '*.cpp' 2>/dev/null |
grep -vP $EXCLUDE_DIRS |
xargs grep $@ -P '}\s*//+\s*namespace\s*'
# Broken symlinks
find -L $ROOT_PATH -type l | grep -v contrib && echo "^ Broken symlinks found"
find -L $ROOT_PATH -type l 2>/dev/null | grep -v contrib && echo "^ Broken symlinks found"
# Double whitespaces
find $ROOT_PATH/dbms -name '*.h' -or -name '*.cpp' | while read i; do $ROOT_PATH/utils/check-style/double-whitespaces.pl < $i || echo -e "^ File $i contains double whitespaces\n"; done
find $ROOT_PATH/{dbms,base} -name '*.h' -or -name '*.cpp' 2>/dev/null | while read i; do $ROOT_PATH/utils/check-style/double-whitespaces.pl < $i || echo -e "^ File $i contains double whitespaces\n"; done