Skip to content

Commit

Permalink
Switch to clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstebila committed Dec 19, 2016
1 parent 5bfeb08 commit 4f76861
Show file tree
Hide file tree
Showing 39 changed files with 1,585 additions and 1,659 deletions.
95 changes: 95 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: ForIndentation
...

2 changes: 1 addition & 1 deletion .travis-style-check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

make prettyprint | grep -q Formatted
clang-format -style=file -output-replacements-xml src/*.h src/*/*.h src/*/*.c | grep -q offset
STATUS=(${PIPESTATUS[*]})

if [ ${STATUS[1]} == 0 ]; then
Expand Down
22 changes: 5 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ matrix:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
before_install:
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
- tar xzf astyle_2.05.1_linux.tar.gz
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
- clang-format
- os: linux
compiler: gcc
env: CC_OQS=gcc-4.9
Expand All @@ -25,10 +22,7 @@ matrix:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
before_install:
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
- tar xzf astyle_2.05.1_linux.tar.gz
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
- clang-format
- os: linux
compiler: gcc
env: CC_OQS=gcc-5
Expand All @@ -38,10 +32,7 @@ matrix:
- ubuntu-toolchain-r-test
packages:
- gcc-5
before_install:
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
- tar xzf astyle_2.05.1_linux.tar.gz
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
- clang-format
- os: linux
compiler: gcc
env: CC_OQS=gcc-6 USE_OPENSSL=1
Expand All @@ -52,15 +43,12 @@ matrix:
packages:
- gcc-6
- libssl-dev
before_install:
- wget http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz
- tar xzf astyle_2.05.1_linux.tar.gz
- cd astyle/build/gcc && make && export PATH=$(pwd)/bin:$PATH && cd ../../../
- clang-format
- os: osx
compiler: clang
env: CC_OQS=clang AES_NI=0 USE_OPENSSL=1
before_install:
- brew install astyle openssl
- brew install clang-format openssl

script:
- make
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ clean:
find . -name .DS_Store -type f -delete

prettyprint:
astyle --style=java --indent=tab --pad-header --pad-oper --align-pointer=name --align-reference=name --suffix=none src/*.h src/*/*.h src/*/*.c
clang-format -style=file -i src/*.h src/*/*.h src/*/*.c
1 change: 0 additions & 1 deletion src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ void OQS_MEM_cleanse(void *ptr, size_t len) {
#endif
}


void OQS_MEM_secure_free(void *ptr, size_t len) {
if (ptr != NULL) {
OQS_MEM_cleanse(ptr, len);
Expand Down
2 changes: 1 addition & 1 deletion src/common/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __OQS_COMMON_H
#define __OQS_COMMON_H

#include<stdlib.h>
#include <stdlib.h>

void OQS_MEM_cleanse(void *ptr, size_t len);
void OQS_MEM_secure_free(void *ptr, size_t len);
Expand Down
Loading

0 comments on commit 4f76861

Please sign in to comment.