Upgraded clang-format to 5.0 (#103)

This commit is contained in:
Tyler Veness
2017-11-19 15:15:41 -08:00
committed by Peter Johnson
parent 7847c69231
commit cf828ca858
5 changed files with 41 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
@@ -32,12 +32,20 @@ BraceWrapping:
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
@@ -45,7 +53,11 @@ Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
@@ -53,9 +65,12 @@ IncludeCategories:
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -64,6 +79,7 @@ NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
@@ -73,7 +89,9 @@ PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false

View File

@@ -1,3 +1,4 @@
sudo: true
dist: trusty
language: java
@@ -11,22 +12,27 @@ matrix:
addons:
apt:
sources:
- deadsnakes
packages:
- g++-multilib
- lib32stdc++6
- python3
- python3-pip
- clang-format-3.8
- python3.5
before_install:
- .travis-scripts/install.sh
- sudo sh -c 'echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main" > /etc/apt/sources.list.d/llvm.list'
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
- sudo apt-get update -q || true
- sudo apt-get install clang-format-5.0 -y
install:
- pip3 install --user wpiformat
- wget https://bootstrap.pypa.io/get-pip.py
- sudo python3.5 get-pip.py
- python3.5 -m pip install --user wpiformat
- ./gradlew build -PbuildAll
script:
- wpiformat -y 2017 -clang 3.8
- python3.5 -m wpiformat -y 2017 -clang 5.0
- git --no-pager diff --exit-code HEAD # Ensure formatter made no changes
- ./gradlew build -PbuildAll

View File

@@ -109,8 +109,9 @@ THandle UnlimitedHandleResource<THandle, TStruct, typeValue, TMutex>::Allocate(
}
template <typename THandle, typename TStruct, int typeValue, typename TMutex>
inline std::shared_ptr<TStruct> UnlimitedHandleResource<
THandle, TStruct, typeValue, TMutex>::Get(THandle handle) {
inline std::shared_ptr<TStruct>
UnlimitedHandleResource<THandle, TStruct, typeValue, TMutex>::Get(
THandle handle) {
auto index =
handle.GetTypedIndex(static_cast<typename THandle::Type>(typeValue));
if (index < 0) return nullptr;

View File

@@ -664,9 +664,8 @@ CS_StatusValue UsbCameraImpl::DeviceCmdSetProperty(
// Check kind match
if ((setString && prop->propKind != CS_PROP_STRING) ||
(!setString &&
(prop->propKind & (CS_PROP_BOOLEAN | CS_PROP_INTEGER | CS_PROP_ENUM)) ==
0))
(!setString && (prop->propKind &
(CS_PROP_BOOLEAN | CS_PROP_INTEGER | CS_PROP_ENUM)) == 0))
return CS_WRONG_PROPERTY_TYPE;
// Handle percentage property

View File

@@ -133,9 +133,10 @@ CS_Bool CS_SetSourceVideoModeDiscrete(CS_Source source,
int width, int height, int fps,
CS_Status* status) {
return cs::SetSourceVideoMode(
source, cs::VideoMode{static_cast<cs::VideoMode::PixelFormat>(
static_cast<int>(pixelFormat)),
width, height, fps},
source,
cs::VideoMode{static_cast<cs::VideoMode::PixelFormat>(
static_cast<int>(pixelFormat)),
width, height, fps},
status);
}