Skip to content

Commit 338c9a0

Browse files
committed
[reformat] Run clang-format over repository
Signed-off-by: Kimball Thurston <[email protected]>
1 parent 3206446 commit 338c9a0

File tree

131 files changed

+7991
-6418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+7991
-6418
lines changed

.clang-format

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
---
22
Language: Cpp
3-
BasedOnStyle: LLVM
4-
AccessModifierOffset: -2
5-
AlignAfterOpenBracket: Align
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: AlwaysBreak
66
AlignConsecutiveAssignments: true
7-
AlignConsecutiveDeclarations: false
7+
AlignConsecutiveDeclarations: true
88
AlignEscapedNewlines: Right
99
AlignOperands: true
1010
AlignTrailingComments: true
11-
AllowAllArgumentsOnNextLine: false
12-
AllowAllConstructorInitializersOnNextLine: true
13-
AllowAllParametersOfDeclarationOnNextLine: false
14-
AllowShortBlocksOnASingleLine: false
15-
AllowShortCaseLabelsOnASingleLine: false
11+
# AllowAllArgumentsOnNextLine: true
12+
AllowAllParametersOfDeclarationOnNextLine: true
13+
# AllowAllConstructorInitializersOnNextLine: true
14+
AllowShortBlocksOnASingleLine: true
15+
AllowShortCaseLabelsOnASingleLine: true
1616
AllowShortFunctionsOnASingleLine: InlineOnly
17-
AllowShortIfStatementsOnASingleLine: false
17+
AllowShortIfStatementsOnASingleLine: true
1818
AllowShortLoopsOnASingleLine: false
19+
# AllowShortLambdasOnASingleLine: true
20+
# ArrayInitializerAlignmentStyle: Left
1921
AlwaysBreakAfterDefinitionReturnType: TopLevel
2022
AlwaysBreakAfterReturnType: None
2123
AlwaysBreakBeforeMultilineStrings: false
2224
AlwaysBreakTemplateDeclarations: MultiLine
2325
BinPackArguments: false
2426
BinPackParameters: false
2527
BraceWrapping:
26-
AfterCaseLabel: true
2728
AfterClass: true
2829
AfterControlStatement: true
2930
AfterEnum: true
@@ -44,16 +45,17 @@ BreakBeforeBraces: Custom
4445
BreakBeforeInheritanceComma: false
4546
BreakInheritanceList: BeforeColon
4647
BreakBeforeTernaryOperators: true
47-
BreakConstructorInitializers: BeforeColon
48+
BreakConstructorInitializersBeforeComma: true
49+
BreakConstructorInitializers: BeforeComma
4850
BreakAfterJavaFieldAnnotations: false
4951
BreakStringLiterals: false
50-
ColumnLimit: 100
52+
ColumnLimit: 80
5153
CommentPragmas: '^ IWYU pragma:'
5254
CompactNamespaces: false
5355
ConstructorInitializerAllOnOneLineOrOnePerLine: true
5456
ConstructorInitializerIndentWidth: 4
5557
ContinuationIndentWidth: 4
56-
Cpp11BracedListStyle: false
58+
Cpp11BracedListStyle: true
5759
DerivePointerAlignment: false
5860
DisableFormat: false
5961
FixNamespaceComments: true
@@ -70,7 +72,7 @@ IncludeCategories:
7072
- Regex: '.*'
7173
Priority: 1
7274
IncludeIsMainRegex: '(Test|_test)?$'
73-
IndentCaseLabels: false
75+
IndentCaseLabels: true
7476
IndentPPDirectives: AfterHash
7577
IndentWidth: 4
7678
IndentWrappedFunctionNames: false
@@ -85,7 +87,7 @@ ObjCBinPackProtocolList: Auto
8587
ObjCBlockIndentWidth: 4
8688
ObjCSpaceAfterProperty: true
8789
ObjCSpaceBeforeProtocolList: true
88-
PenaltyBreakAssignment: 8
90+
PenaltyBreakAssignment: 4
8991
PenaltyBreakBeforeFirstCallParameter: 8
9092
PenaltyBreakComment: 1000
9193
PenaltyBreakFirstLessLess: 120
@@ -100,21 +102,20 @@ SortUsingDeclarations: true
100102
SpaceAfterCStyleCast: true
101103
SpaceAfterTemplateKeyword: true
102104
SpaceBeforeAssignmentOperators: true
103-
SpaceBeforeCpp11BracedList: true
105+
SpaceBeforeCpp11BracedList: false
104106
SpaceBeforeCtorInitializerColon: true
105107
SpaceBeforeInheritanceColon: true
106-
SpaceBeforeParens: NonEmptyParentheses
107-
SpaceBeforeRangeBasedForLoopColon: true
108-
SpaceInEmptyBlock: false
108+
SpaceBeforeParens: Always
109+
SpaceBeforeRangeBasedForLoopColon: false
109110
SpaceInEmptyParentheses: false
110111
SpacesBeforeTrailingComments: 1
111112
SpacesInAngles: false
112113
SpacesInContainerLiterals: true
113114
SpacesInCStyleCastParentheses: false
114115
SpacesInParentheses: false
115116
SpacesInSquareBrackets: false
116-
SpacesInConditionalStatement: false
117117
Standard: Cpp11
118-
TabWidth: 4
118+
TabWidth: 8
119+
#UseTab: ForIndentation
119120
UseTab: Never
120121
...

config/ImathConfig.h.in

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// Options / configuration based on O.S. / compiler
1313
//
1414

15+
// automated formatting does not handle the cmake tags well
16+
// clang-format off
17+
1518
//
1619
// Define whether the half-to-float conversion should use the lookup
1720
// table method. Note that this is overriden by F16C compiler
@@ -51,13 +54,16 @@
5154
#define IMATH_VERSION_PATCH @Imath_VERSION_PATCH@
5255
#define IMATH_VERSION_RELEASE_TYPE "@IMATH_VERSION_RELEASE_TYPE@"
5356

54-
#define IMATH_VERSION_HEX ((uint32_t(IMATH_VERSION_MAJOR) << 24) | \
55-
(uint32_t(IMATH_VERSION_MINOR) << 16) | \
56-
(uint32_t(IMATH_VERSION_PATCH) << 8))
57+
#define IMATH_VERSION_HEX \
58+
((uint32_t (IMATH_VERSION_MAJOR) << 24) | \
59+
(uint32_t (IMATH_VERSION_MINOR) << 16) | \
60+
(uint32_t (IMATH_VERSION_PATCH) << 8))
5761

5862
// IMATH_LIB_VERSION is the library API version: SOCURRENT.SOAGE.SOREVISION
5963
#define IMATH_LIB_VERSION_STRING "@IMATH_LIB_VERSION@"
6064

65+
// clang-format on
66+
6167
//
6268
// Code that depends on the v2 ExcMath mechanism of signal handlers
6369
// that throw exceptions is incompatible with noexcept, since
@@ -69,9 +75,9 @@
6975

7076
#cmakedefine01 IMATH_USE_NOEXCEPT
7177
#if IMATH_USE_NOEXCEPT
72-
#define IMATH_NOEXCEPT noexcept
78+
# define IMATH_NOEXCEPT noexcept
7379
#else
74-
#define IMATH_NOEXCEPT
80+
# define IMATH_NOEXCEPT
7581
#endif
7682

7783
//
@@ -84,25 +90,23 @@
8490
// templates from compiling correctly.
8591
//
8692
#ifndef IMATH_FOREIGN_VECTOR_INTEROP
87-
# if defined(__GNUC__) && __GNUC__ == 4 && !defined(__clang__)
88-
# define IMATH_FOREIGN_VECTOR_INTEROP 0
89-
# else
90-
# define IMATH_FOREIGN_VECTOR_INTEROP 1
91-
# endif
93+
# if defined(__GNUC__) && __GNUC__ == 4 && !defined(__clang__)
94+
# define IMATH_FOREIGN_VECTOR_INTEROP 0
95+
# else
96+
# define IMATH_FOREIGN_VECTOR_INTEROP 1
97+
# endif
9298
#endif
9399

94-
95100
//
96101
// Decorator that makes a function available for both CPU and GPU, when
97102
// compiling for Cuda.
98103
//
99104
#ifdef __CUDACC__
100-
#define IMATH_HOSTDEVICE __host__ __device__
105+
# define IMATH_HOSTDEVICE __host__ __device__
101106
#else
102-
#define IMATH_HOSTDEVICE
107+
# define IMATH_HOSTDEVICE
103108
#endif
104109

105-
106110
//
107111
// Some compilers define a special intrinsic to use in conditionals that can
108112
// speed up extremely performance-critical spots if the conditional is
@@ -118,38 +122,37 @@
118122
//
119123
#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
120124
# ifdef __cplusplus
121-
# define IMATH_LIKELY(x) (__builtin_expect(static_cast<bool>(x), true))
122-
# define IMATH_UNLIKELY(x) (__builtin_expect(static_cast<bool>(x), false))
125+
# define IMATH_LIKELY(x) (__builtin_expect (static_cast<bool> (x), true))
126+
# define IMATH_UNLIKELY(x) \
127+
(__builtin_expect (static_cast<bool> (x), false))
123128
# else
124-
# define IMATH_LIKELY(x) (__builtin_expect((x), 1))
125-
# define IMATH_UNLIKELY(x) (__builtin_expect((x), 0))
129+
# define IMATH_LIKELY(x) (__builtin_expect ((x), 1))
130+
# define IMATH_UNLIKELY(x) (__builtin_expect ((x), 0))
126131
# endif
127132
#else
128133
# define IMATH_LIKELY(x) (x)
129134
# define IMATH_UNLIKELY(x) (x)
130135
#endif
131136

132-
133137
// On modern versions of gcc & clang, __has_attribute can test support for
134138
// __attribute__((attr)). Make sure it's safe for other compilers.
135139
#ifndef __has_attribute
136140
# define __has_attribute(x) 0
137141
#endif
138142

139-
140143
//
141144
// Simple way to mark things as deprecated.
142145
// When we are sure that C++14 is our true minimum, then we can just
143146
// directly use [[deprecated(msg)]].
144147
//
145148
#if defined(_MSC_VER)
146-
# define IMATH_DEPRECATED(msg) __declspec(deprecated(msg))
149+
# define IMATH_DEPRECATED(msg) __declspec(deprecated (msg))
147150
#elif defined(__cplusplus) && __cplusplus >= 201402L
148-
# define IMATH_DEPRECATED(msg) [[deprecated(msg)]]
151+
# define IMATH_DEPRECATED(msg) [[deprecated (msg)]]
149152
#elif defined(__GNUC__) || defined(__clang__)
150-
# define IMATH_DEPRECATED(msg) __attribute__((deprecated(msg)))
153+
# define IMATH_DEPRECATED(msg) __attribute__ ((deprecated (msg)))
151154
#else
152-
# define IMATH_DEPRECATED(msg) /* unsupported on this platform */
155+
# define IMATH_DEPRECATED(msg) /* unsupported on this platform */
153156
#endif
154157

155158
// Whether the user configured the library to have symbol visibility
@@ -159,13 +162,16 @@
159162
// MSVC does not do the same visibility attributes, and when we are
160163
// compiling a static library we won't be in DLL mode, but just don't
161164
// define these and the export headers will work out
162-
#if ! defined(_MSC_VER) && defined(IMATH_ENABLE_API_VISIBILITY)
163-
# define IMATH_PUBLIC_SYMBOL_ATTRIBUTE __attribute__ ((__visibility__ ("default")))
164-
# define IMATH_PRIVATE_SYMBOL_ATTRIBUTE __attribute__ ((__visibility__ ("hidden")))
165+
#if !defined(_MSC_VER) && defined(IMATH_ENABLE_API_VISIBILITY)
166+
# define IMATH_PUBLIC_SYMBOL_ATTRIBUTE \
167+
__attribute__ ((__visibility__ ("default")))
168+
# define IMATH_PRIVATE_SYMBOL_ATTRIBUTE \
169+
__attribute__ ((__visibility__ ("hidden")))
165170
// clang differs from gcc and has type visibility which is needed for enums and templates
166-
# if __has_attribute(__type_visibility__)
167-
# define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE __attribute__ ((__type_visibility__ ("default")))
168-
# endif
171+
# if __has_attribute(__type_visibility__)
172+
# define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE \
173+
__attribute__ ((__type_visibility__ ("default")))
174+
# endif
169175
#endif
170176

171177
#endif // INCLUDED_IMATH_CONFIG_H

docs/examples/Box.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
#include <Imath/ImathBox.h>
2-
2+
33
void
4-
box_example()
4+
box_example ()
55
{
6-
Imath::V3f a (0, 0, 0);
7-
Imath::V3f b (1, 1, 1);
8-
Imath::V3f c (2, 9, 2);
6+
Imath::V3f a (0, 0, 0);
7+
Imath::V3f b (1, 1, 1);
8+
Imath::V3f c (2, 9, 2);
99

1010
Imath::Box3f box (a);
1111

12-
assert (box.isEmpty());
13-
assert (!box.isInfinite());
14-
assert (!box.hasVolume());
15-
12+
assert (box.isEmpty ());
13+
assert (!box.isInfinite ());
14+
assert (!box.hasVolume ());
15+
1616
box.extendBy (c);
1717

18-
assert (box.size() == (c-a));
18+
assert (box.size () == (c - a));
1919
assert (box.intersects (b));
2020
assert (box.max[0] > box.min[0]);
2121
assert (box.max[1] > box.min[1]);
2222
assert (box.max[2] > box.min[2]);
23-
assert (box.hasVolume());
24-
assert (box.majorAxis() == 1);
23+
assert (box.hasVolume ());
24+
assert (box.majorAxis () == 1);
2525
}

docs/examples/Color3.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include <Imath/ImathColor.h>
22

33
void
4-
color3_example()
4+
color3_example ()
55
{
6-
Imath::C3c r (255, 0, 0);
7-
Imath::C3c g (0, 255, 0);
8-
Imath::C3c b (0, 0, 255);
9-
10-
Imath::C3c c = r + g + b;
6+
Imath::C3c r (255, 0, 0);
7+
Imath::C3c g (0, 255, 0);
8+
Imath::C3c b (0, 0, 255);
9+
10+
Imath::C3c c = r + g + b;
1111

1212
assert (c.x == 255);
1313
assert (c.x == 255);

docs/examples/Color4.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include <Imath/ImathColor.h>
22

33
void
4-
color4_example()
4+
color4_example ()
55
{
6-
Imath::C4f r (1.0f, 0.0f, 0.0f, 1.0f);
7-
Imath::C4f g (0.0f, 1.0f, 0.0f, 1.0f);
8-
Imath::C4f b (0.0f, 0.0f, 1.0f, 1.0f);
9-
10-
Imath::C4f w = r + g + b;
6+
Imath::C4f r (1.0f, 0.0f, 0.0f, 1.0f);
7+
Imath::C4f g (0.0f, 1.0f, 0.0f, 1.0f);
8+
Imath::C4f b (0.0f, 0.0f, 1.0f, 1.0f);
9+
10+
Imath::C4f w = r + g + b;
1111

1212
assert (w.r == 1.0f);
1313
assert (w.g == 1.0f);

docs/examples/Euler.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#include <ImathMatrixAlgo.h>
33

44
void
5-
euler_example()
5+
euler_example ()
66
{
77
int i, j, k;
8-
8+
99
Imath::Eulerf xyz (Imath::Eulerf::XYZ);
1010
xyz.angleOrder (i, j, k);
1111
assert (i == 0 && j == 1 && k == 2);
@@ -18,7 +18,6 @@ euler_example()
1818
Imath::Eulerf e2 (0.0f, 0.0f, 0.1f);
1919

2020
e1.makeNear (e2);
21-
Imath::V3f v = e2.toXYZVector();
21+
Imath::V3f v = e2.toXYZVector ();
2222
assert (v.equalWithAbsError (Imath::V3f (0.0f, 0.0f, 0.1f), 0.00001f));
2323
}
24-

docs/examples/Frustum.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#include <Imath/ImathFrustum.h>
22

33
void
4-
frustum_example()
4+
frustum_example ()
55
{
6-
float near = 1.7f;
7-
float far = 567.0f;
8-
float left = -3.5f;
9-
float right = 2.0f;
10-
float top = 0.9f;
6+
float near = 1.7f;
7+
float far = 567.0f;
8+
float left = -3.5f;
9+
float right = 2.0f;
10+
float top = 0.9f;
1111
float bottom = -1.3f;
1212

1313
Imath::Frustumf frustum (near, far, left, right, top, bottom, false);
1414

15-
Imath::M44f m = frustum.projectionMatrix();
15+
Imath::M44f m = frustum.projectionMatrix ();
1616

1717
Imath::V3f p (1.0f, 1.0f, 1.0f);
1818
Imath::V2f s = frustum.projectPointToScreen (p);

0 commit comments

Comments
 (0)