From 2e41e71ffb6d12325f9f0bee5dc79539dfc02cb5 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Fri, 16 Oct 2015 13:50:36 -0400 Subject: Use C++03 standard for source code formatting --- .clang-format | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ floattypes.h | 5 +++-- selftest.cc | 72 +++++++++++++++++++++++++++++------------------------------ 3 files changed, 104 insertions(+), 38 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..cce40f6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,65 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: true +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AlwaysBreakAfterDefinitionReturnType: false +AlwaysBreakTemplateDeclarations: false +AlwaysBreakBeforeMultilineStrings: false +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BinPackParameters: true +BinPackArguments: true +ColumnLimit: 80 +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +DerivePointerAlignment: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: false +IndentWrappedFunctionNames: false +IndentFunctionDeclarationAfterType: false +MaxEmptyLinesToKeep: 1 +KeepEmptyLinesAtTheStartOfBlocks: true +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakString: 1000 +PenaltyBreakFirstLessLess: 120 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +SpacesBeforeTrailingComments: 1 +Cpp11BracedListStyle: true +Standard: Cpp03 +IndentWidth: 2 +TabWidth: 8 +UseTab: Never +BreakBeforeBraces: Attach +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpacesInAngles: false +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpaceAfterCStyleCast: false +SpacesInContainerLiterals: true +SpaceBeforeAssignmentOperators: true +ContinuationIndentWidth: 4 +CommentPragmas: '^ IWYU pragma:' +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +SpaceBeforeParens: ControlStatements +DisableFormat: false +... + diff --git a/floattypes.h b/floattypes.h index e037b95..fa4cc44 100644 --- a/floattypes.h +++ b/floattypes.h @@ -34,8 +34,9 @@ using namespace std; #ifndef static_assert #define VML_CONCAT2(x, y) x##y #define VML_CONCAT(x, y) VML_CONCAT2(x, y) -#define static_assert(cond, msg) typedef int VML_CONCAT( \ - vml_static_assert_, __LINE__)[(cond) ? 1 : -1] __attribute__((__unused__)) +#define static_assert(cond, msg) \ + typedef int VML_CONCAT(vml_static_assert_, __LINE__)[(cond) ? 1 : -1] \ + __attribute__((__unused__)) #endif // Capture libc macros, then undefine them diff --git a/selftest.cc b/selftest.cc index 334d95f..5e1a943 100644 --- a/selftest.cc +++ b/selftest.cc @@ -1638,78 +1638,78 @@ int main(int argc, char **argv) { cout << "Testing math functions:\n" << "[" VECMATHLIB_CONFIGURATION "]\n" << flush; - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef VECMATHLIB_HAVE_VEC_FLOAT_1 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef VECMATHLIB_HAVE_VEC_FLOAT_2 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef VECMATHLIB_HAVE_VEC_FLOAT_4 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif #ifdef VECMATHLIB_HAVE_VEC_FLOAT_8 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); - vecmathlib_test>::test(); + vecmathlib_test >::test(); + vecmathlib_test >::test(); #endif #ifdef VECMATHLIB_HAVE_VEC_FLOAT_16 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); - vecmathlib_test>::test(); + vecmathlib_test >::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef VECMATHLIB_HAVE_VEC_DOUBLE_1 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef VECMATHLIB_HAVE_VEC_DOUBLE_2 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif #ifdef VECMATHLIB_HAVE_VEC_DOUBLE_4 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); - vecmathlib_test>::test(); + vecmathlib_test >::test(); + vecmathlib_test >::test(); #endif #ifdef VECMATHLIB_HAVE_VEC_DOUBLE_8 - vecmathlib_test>::test(); + vecmathlib_test >::test(); #ifdef __clang__ - vecmathlib_test>::test(); + vecmathlib_test >::test(); #endif - vecmathlib_test>::test(); - vecmathlib_test>::test(); + vecmathlib_test >::test(); + vecmathlib_test >::test(); #endif cout << "\n"; -- cgit v1.1