Skip to content

Commit 80b5ed3

Browse files
committed
introduced clang-format (close #733)
1 parent be5ad37 commit 80b5ed3

File tree

125 files changed

+1534
-2174
lines changed

Some content is hidden

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

125 files changed

+1534
-2174
lines changed

.clang-format

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
BasedOnStyle: llvm
2+
---
3+
AccessModifierOffset: -4
4+
AlignEscapedNewlines: DontAlign
5+
AllowShortBlocksOnASingleLine: Empty
6+
AllowShortEnumsOnASingleLine: true
7+
AllowShortFunctionsOnASingleLine: Empty
8+
AllowShortIfStatementsOnASingleLine: WithoutElse
9+
AllowShortLoopsOnASingleLine: true
10+
AlwaysBreakTemplateDeclarations: Yes
11+
BreakBeforeBinaryOperators: NonAssignment
12+
BreakBeforeTernaryOperators: true
13+
ColumnLimit: 0
14+
DerivePointerAlignment: false
15+
IncludeCategories:
16+
- Regex: '<[[:alnum:]_]+>'
17+
Priority: 1
18+
- Regex: '<(gtest|gmock)/'
19+
Priority: 2
20+
- Regex: '<[[:alnum:]_./]+>'
21+
Priority: 3
22+
- Regex: '<entt/'
23+
Priority: 4
24+
- Regex: '.*'
25+
Priority: 5
26+
IndentPPDirectives: AfterHash
27+
IndentWidth: 4
28+
KeepEmptyLinesAtTheStartOfBlocks: false
29+
Language: Cpp
30+
PointerAlignment: Right
31+
SpaceAfterCStyleCast: false
32+
SpaceAfterTemplateKeyword: false
33+
SpaceAroundPointerQualifiers: After
34+
SpaceBeforeCaseColon: false
35+
SpaceBeforeCtorInitializerColon: false
36+
SpaceBeforeInheritanceColon: false
37+
SpaceBeforeParens: Never
38+
SpaceBeforeRangeBasedForLoopColon: false
39+
Standard: Latest
40+
TabWidth: 4
41+
UseTab: Never

src/entt/config/config.h

+33-43
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,71 @@
11
#ifndef ENTT_CONFIG_CONFIG_H
22
#define ENTT_CONFIG_CONFIG_H
33

4-
54
#if defined(__cpp_exceptions) && !defined(ENTT_NOEXCEPTION)
6-
# define ENTT_NOEXCEPT noexcept
7-
# define ENTT_THROW throw
8-
# define ENTT_TRY try
9-
# define ENTT_CATCH catch(...)
5+
# define ENTT_NOEXCEPT noexcept
6+
# define ENTT_THROW throw
7+
# define ENTT_TRY try
8+
# define ENTT_CATCH catch(...)
109
#else
11-
# define ENTT_NOEXCEPT
12-
# define ENTT_THROW
13-
# define ENTT_TRY if(true)
14-
# define ENTT_CATCH if(false)
10+
# define ENTT_NOEXCEPT
11+
# define ENTT_THROW
12+
# define ENTT_TRY if(true)
13+
# define ENTT_CATCH if(false)
1514
#endif
1615

17-
1816
#if defined(__cpp_lib_launder) && __cpp_lib_launder >= 201606L
19-
# include <new>
20-
# define ENTT_LAUNDER(expr) std::launder(expr)
17+
# include <new>
18+
# define ENTT_LAUNDER(expr) std::launder(expr)
2119
#else
22-
# define ENTT_LAUNDER(expr) expr
20+
# define ENTT_LAUNDER(expr) expr
2321
#endif
2422

25-
2623
#ifndef ENTT_USE_ATOMIC
27-
# define ENTT_MAYBE_ATOMIC(Type) Type
24+
# define ENTT_MAYBE_ATOMIC(Type) Type
2825
#else
29-
# include <atomic>
30-
# define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
26+
# include <atomic>
27+
# define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
3128
#endif
3229

33-
3430
#ifndef ENTT_ID_TYPE
35-
# include <cstdint>
36-
# define ENTT_ID_TYPE std::uint32_t
31+
# include <cstdint>
32+
# define ENTT_ID_TYPE std::uint32_t
3733
#endif
3834

39-
4035
#ifndef ENTT_SPARSE_PAGE
41-
# define ENTT_SPARSE_PAGE 4096
36+
# define ENTT_SPARSE_PAGE 4096
4237
#endif
4338

44-
4539
#ifndef ENTT_PACKED_PAGE
46-
# define ENTT_PACKED_PAGE 1024
40+
# define ENTT_PACKED_PAGE 1024
4741
#endif
4842

49-
5043
#ifdef ENTT_DISABLE_ASSERT
51-
# undef ENTT_ASSERT
52-
# define ENTT_ASSERT(...) (void(0))
44+
# undef ENTT_ASSERT
45+
# define ENTT_ASSERT(...) (void(0))
5346
#elif !defined ENTT_ASSERT
54-
# include <cassert>
55-
# define ENTT_ASSERT(condition, ...) assert(condition)
47+
# include <cassert>
48+
# define ENTT_ASSERT(condition, ...) assert(condition)
5649
#endif
5750

58-
5951
#ifdef ENTT_NO_ETO
60-
# include <type_traits>
61-
# define ENTT_IGNORE_IF_EMPTY std::false_type
52+
# include <type_traits>
53+
# define ENTT_IGNORE_IF_EMPTY std::false_type
6254
#else
63-
# include <type_traits>
64-
# define ENTT_IGNORE_IF_EMPTY std::true_type
55+
# include <type_traits>
56+
# define ENTT_IGNORE_IF_EMPTY std::true_type
6557
#endif
6658

67-
6859
#ifndef ENTT_STANDARD_CPP
6960
# if defined __clang__ || defined __GNUC__
70-
# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
71-
# define ENTT_PRETTY_FUNCTION_PREFIX '='
72-
# define ENTT_PRETTY_FUNCTION_SUFFIX ']'
61+
# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
62+
# define ENTT_PRETTY_FUNCTION_PREFIX '='
63+
# define ENTT_PRETTY_FUNCTION_SUFFIX ']'
7364
# elif defined _MSC_VER
74-
# define ENTT_PRETTY_FUNCTION __FUNCSIG__
75-
# define ENTT_PRETTY_FUNCTION_PREFIX '<'
76-
# define ENTT_PRETTY_FUNCTION_SUFFIX '>'
77-
# endif
65+
# define ENTT_PRETTY_FUNCTION __FUNCSIG__
66+
# define ENTT_PRETTY_FUNCTION_PREFIX '<'
67+
# define ENTT_PRETTY_FUNCTION_SUFFIX '>'
68+
# endif
7869
#endif
7970

80-
8171
#endif

src/entt/config/version.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#ifndef ENTT_CONFIG_VERSION_H
22
#define ENTT_CONFIG_VERSION_H
33

4-
54
#define ENTT_VERSION_MAJOR 3
65
#define ENTT_VERSION_MINOR 9
76
#define ENTT_VERSION_PATCH 0
87

9-
108
#endif

src/entt/core/algorithm.hpp

+7-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
#ifndef ENTT_CORE_ALGORITHM_HPP
22
#define ENTT_CORE_ALGORITHM_HPP
33

4-
5-
#include <vector>
6-
#include <utility>
7-
#include <iterator>
84
#include <algorithm>
95
#include <functional>
6+
#include <iterator>
7+
#include <utility>
8+
#include <vector>
109
#include "utility.hpp"
1110

12-
1311
namespace entt {
1412

15-
1613
/**
1714
* @brief Function object to wrap `std::sort` in a class type.
1815
*
@@ -36,12 +33,11 @@ struct std_sort {
3633
* @param args Arguments to forward to the sort function, if any.
3734
*/
3835
template<typename It, typename Compare = std::less<>, typename... Args>
39-
void operator()(It first, It last, Compare compare = Compare{}, Args &&... args) const {
36+
void operator()(It first, It last, Compare compare = Compare{}, Args &&...args) const {
4037
std::sort(std::forward<Args>(args)..., std::move(first), std::move(last), std::move(compare));
4138
}
4239
};
4340

44-
4541
/*! @brief Function object for performing insertion sort. */
4642
struct insertion_sort {
4743
/**
@@ -62,8 +58,8 @@ struct insertion_sort {
6258
auto value = std::move(*it);
6359
auto pre = it;
6460

65-
for(; pre > first && compare(value, *(pre-1)); --pre) {
66-
*pre = std::move(*(pre-1));
61+
for(; pre > first && compare(value, *(pre - 1)); --pre) {
62+
*pre = std::move(*(pre - 1));
6763
}
6864

6965
*pre = std::move(value);
@@ -72,7 +68,6 @@ struct insertion_sort {
7268
}
7369
};
7470

75-
7671
/**
7772
* @brief Function object for performing LSD radix sort.
7873
* @tparam Bit Number of bits processed per pass.
@@ -137,8 +132,6 @@ struct radix_sort {
137132
}
138133
};
139134

140-
141-
}
142-
135+
} // namespace entt
143136

144137
#endif

0 commit comments

Comments
 (0)