Skip to content

Commit 7059871

Browse files
Merge pull request #2931 from verilog-to-routing/temp_format_try1
Partial update of the code base to be consistent with rules in .clang-format file
2 parents 3165d02 + 24c943f commit 7059871

File tree

132 files changed

+752
-833
lines changed

Some content is hidden

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

132 files changed

+752
-833
lines changed

.clang-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ IncludeIsMainRegex: '([-_](test|unittest))?$'
6868
IndentCaseLabels: true
6969
IndentWidth: 4
7070
IndentWrappedFunctionNames: false
71-
IndentPPDirectives: AfterHash
71+
IndentPPDirectives: None
7272
JavaScriptQuotes: Leave
7373
JavaScriptWrapImports: true
74-
KeepEmptyLinesAtTheStartOfBlocks: false
74+
KeepEmptyLinesAtTheStartOfBlocks: true
7575
MacroBlockBegin: ''
7676
MacroBlockEnd: ''
7777
MaxEmptyLinesToKeep: 1

libs/librtlnumber/src/include/rtl_utils.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616
#include <stdint.h>
1717

1818
#ifndef FILE_NAME
19-
# define FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
19+
#define FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
2020
#endif
2121

2222
/* Enable Debug Messages for libRTLNumber: Un-Comment to Enable Debug Messages:
2323
* Comment-out to Disable Debug Messages: */
2424
// #define ENABLE_DEBUG_MESSAGES
2525

2626
#ifdef ENABLE_DEBUG_MESSAGES
27-
# define DEBUG_MSG(debugMsg) std::cerr << "DEBUG: " << FILE_NAME << ":" << __LINE__ << " " << __func__ << "()" \
28-
<< ": " << debugMsg << std::endl
27+
#define DEBUG_MSG(debugMsg) std::cerr << "DEBUG: " << FILE_NAME << ":" << __LINE__ << " " << __func__ << "()" \
28+
<< ": " << debugMsg << std::endl
2929
#else
30-
# define DEBUG_MSG(debugMsg) /* No-Op */
30+
#define DEBUG_MSG(debugMsg) /* No-Op */
3131
#endif
3232

3333
#ifndef WARN_MSG
34-
# define WARN_MSG(warnMSG) std::cerr << "WARNING: " << FILE_NAME << ":" << __LINE__ << " " << __func__ << "()" \
35-
<< ": " << warnMSG << "!" << std::endl
34+
#define WARN_MSG(warnMSG) std::cerr << "WARNING: " << FILE_NAME << ":" << __LINE__ << " " << __func__ << "()" \
35+
<< ": " << warnMSG << "!" << std::endl
3636
#endif
3737

3838
#ifndef ERR_MSG
39-
# define ERR_MSG(errMsg) std::cerr << std::endl \
40-
<< "ERROR: " << FILE_NAME << ":" << __LINE__ << " " << __func__ << "()" \
41-
<< ": " << errMsg << "!" << std::endl \
42-
<< std::endl
39+
#define ERR_MSG(errMsg) std::cerr << std::endl \
40+
<< "ERROR: " << FILE_NAME << ":" << __LINE__ << " " << __func__ << "()" \
41+
<< ": " << errMsg << "!" << std::endl \
42+
<< std::endl
4343
#endif
4444

4545
std::string string_of_radix_to_bitstring(std::string orig_string, size_t radix);

libs/libvtrutil/src/specrand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ unsigned long SpecRandomNumberGenerator::spec_genrand_int32_() {
112112

113113
if (mti >= N) { /* generate N words at one time */
114114

115-
if (mti == N + 1) /* if init_genrand() has not been called, */
115+
if (mti == N + 1) /* if init_genrand() has not been called, */
116116
spec_init_genrand_(5489UL); /* a default initial seed is used */
117117

118118
for (size_t kk = 0; kk < N - M; kk++) {

libs/libvtrutil/src/specrand.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ class SpecRandomNumberGenerator : public vtr::RandomNumberGeneratorInterface {
114114
size_t mti = N + 1;
115115
/// the array for the state vector
116116
unsigned long mt[N];
117-
118117
};
119118

120119
#endif

libs/libvtrutil/src/tl_optional.hpp

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -32,78 +32,78 @@
3232
#include <utility>
3333

3434
#if (defined(_MSC_VER) && _MSC_VER == 1900)
35-
# define TL_OPTIONAL_MSVC2015
35+
#define TL_OPTIONAL_MSVC2015
3636
#endif
3737

3838
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && !defined(__clang__))
39-
# define TL_OPTIONAL_GCC49
39+
#define TL_OPTIONAL_GCC49
4040
#endif
4141

4242
#if (defined(__GNUC__) && __GNUC__ == 5 && __GNUC_MINOR__ <= 4 && !defined(__clang__))
43-
# define TL_OPTIONAL_GCC54
43+
#define TL_OPTIONAL_GCC54
4444
#endif
4545

4646
#if (defined(__GNUC__) && __GNUC__ == 5 && __GNUC_MINOR__ <= 5 && !defined(__clang__))
47-
# define TL_OPTIONAL_GCC55
47+
#define TL_OPTIONAL_GCC55
4848
#endif
4949

5050
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && !defined(__clang__))
5151
// GCC < 5 doesn't support overloading on const&& for member functions
52-
# define TL_OPTIONAL_NO_CONSTRR
52+
#define TL_OPTIONAL_NO_CONSTRR
5353

5454
// GCC < 5 doesn't support some standard C++11 type traits
55-
# define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
56-
std::has_trivial_copy_constructor<T>::value
57-
# define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T) std::has_trivial_copy_assign<T>::value
55+
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
56+
std::has_trivial_copy_constructor<T>::value
57+
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T) std::has_trivial_copy_assign<T>::value
5858

5959
// This one will be different for GCC 5.7 if it's ever supported
60-
# define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
60+
#define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
6161

6262
// GCC 5 < v < 8 has a bug in is_trivially_copy_constructible which breaks std::vector
6363
// for non-copyable types
6464
#elif (defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__))
65-
# ifndef TL_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX
66-
# define TL_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX
65+
#ifndef TL_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX
66+
#define TL_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX
6767
namespace tl {
6868
namespace detail {
6969
template<class T>
7070
struct is_trivially_copy_constructible : std::is_trivially_copy_constructible<T> {};
71-
# ifdef _GLIBCXX_VECTOR
71+
#ifdef _GLIBCXX_VECTOR
7272
template<class T, class A>
7373
struct is_trivially_copy_constructible<std::vector<T, A>>
7474
: std::is_trivially_copy_constructible<T> {};
75-
# endif
75+
#endif
7676
} // namespace detail
7777
} // namespace tl
78-
# endif
78+
#endif
7979

80-
# define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
81-
tl::detail::is_trivially_copy_constructible<T>::value
82-
# define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \
83-
std::is_trivially_copy_assignable<T>::value
84-
# define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
80+
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
81+
tl::detail::is_trivially_copy_constructible<T>::value
82+
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \
83+
std::is_trivially_copy_assignable<T>::value
84+
#define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
8585
#else
86-
# define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
87-
std::is_trivially_copy_constructible<T>::value
88-
# define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \
89-
std::is_trivially_copy_assignable<T>::value
90-
# define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
86+
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
87+
std::is_trivially_copy_constructible<T>::value
88+
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \
89+
std::is_trivially_copy_assignable<T>::value
90+
#define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
9191
#endif
9292

9393
#if __cplusplus > 201103L
94-
# define TL_OPTIONAL_CXX14
94+
#define TL_OPTIONAL_CXX14
9595
#endif
9696

9797
// constexpr implies const in C++11, not C++14
9898
#if (__cplusplus == 201103L || defined(TL_OPTIONAL_MSVC2015) || defined(TL_OPTIONAL_GCC49))
99-
# define TL_OPTIONAL_11_CONSTEXPR
99+
#define TL_OPTIONAL_11_CONSTEXPR
100100
#else
101-
# define TL_OPTIONAL_11_CONSTEXPR constexpr
101+
#define TL_OPTIONAL_11_CONSTEXPR constexpr
102102
#endif
103103

104104
namespace tl {
105105
#ifndef TL_MONOSTATE_INPLACE_MUTEX
106-
# define TL_MONOSTATE_INPLACE_MUTEX
106+
#define TL_MONOSTATE_INPLACE_MUTEX
107107
/// Used to represent an optional with no data; essentially a bool
108108
class monostate {};
109109

@@ -120,7 +120,7 @@ class optional;
120120

121121
namespace detail {
122122
#ifndef TL_TRAITS_MUTEX
123-
# define TL_TRAITS_MUTEX
123+
#define TL_TRAITS_MUTEX
124124
// C++14-style aliases for brevity
125125
template<class T>
126126
using remove_const_t = typename std::remove_const<T>::type;
@@ -142,14 +142,14 @@ template<class B, class... Bs>
142142
struct conjunction<B, Bs...>
143143
: std::conditional<bool(B::value), conjunction<Bs...>, B>::type {};
144144

145-
# if defined(_LIBCPP_VERSION) && __cplusplus == 201103L
146-
# define TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
147-
# endif
145+
#if defined(_LIBCPP_VERSION) && __cplusplus == 201103L
146+
#define TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
147+
#endif
148148

149149
// In C++11 mode, there's an issue in libc++'s std::mem_fn
150150
// which results in a hard-error when using it in a noexcept expression
151151
// in some cases. This is a check to workaround the common failing case.
152-
# ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
152+
#ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
153153
template<class T>
154154
struct is_pointer_to_non_const_member_func : std::false_type {};
155155
template<class T, class Ret, class... Args>
@@ -171,14 +171,14 @@ template<class T>
171171
struct is_const_or_const_ref<T const&> : std::true_type {};
172172
template<class T>
173173
struct is_const_or_const_ref<T const> : std::true_type {};
174-
# endif
174+
#endif
175175

176176
// std::invoke from C++17
177177
// https://stackoverflow.com/questions/38288042/c11-14-invoke-workaround
178178
template<typename Fn, typename... Args,
179-
# ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
179+
#ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
180180
typename = enable_if_t<!(is_pointer_to_non_const_member_func<Fn>::value && is_const_or_const_ref<Args...>::value)>,
181-
# endif
181+
#endif
182182
typename = enable_if_t<std::is_member_pointer<decay_t<Fn>>::value>,
183183
int = 0>
184184
constexpr auto invoke(Fn&& f, Args&&... args) noexcept(
@@ -212,14 +212,14 @@ using invoke_result = invoke_result_impl<F, void, Us...>;
212212
template<class F, class... Us>
213213
using invoke_result_t = typename invoke_result<F, Us...>::type;
214214

215-
# if defined(_MSC_VER) && _MSC_VER <= 1900
215+
#if defined(_MSC_VER) && _MSC_VER <= 1900
216216
// TODO make a version which works with MSVC 2015
217217
template<class T, class U = T>
218218
struct is_swappable : std::true_type {};
219219

220220
template<class T, class U = T>
221221
struct is_nothrow_swappable : std::true_type {};
222-
# else
222+
#else
223223
// https://stackoverflow.com/questions/26744589/what-is-a-proper-way-to-implement-is-swappable-to-test-for-the-swappable-concept
224224
namespace swap_adl_tests {
225225
// if swap ADL finds this then it would call std::swap otherwise (same
@@ -276,7 +276,7 @@ struct is_nothrow_swappable
276276
bool,
277277
is_swappable<T, U>::value && ((decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value && detail::swap_adl_tests::is_std_swap_noexcept<T>::value) || (!decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value && detail::swap_adl_tests::is_adl_swap_noexcept<T, U>::value))> {
278278
};
279-
# endif
279+
#endif
280280
#endif
281281

282282
// std::void_t from C++17
@@ -719,7 +719,7 @@ class optional : private detail::optional_move_assign_base<T>,
719719
: result(nullopt);
720720
}
721721

722-
# ifndef TL_OPTIONAL_NO_CONSTRR
722+
#ifndef TL_OPTIONAL_NO_CONSTRR
723723
template<class F>
724724
constexpr auto and_then(F&& f) const&& {
725725
using result = detail::invoke_result_t<F, const T&&>;
@@ -729,7 +729,7 @@ class optional : private detail::optional_move_assign_base<T>,
729729
return has_value() ? detail::invoke(std::forward<F>(f), std::move(**this))
730730
: result(nullopt);
731731
}
732-
# endif
732+
#endif
733733
#else
734734
/// Carries out some operation which returns an optional on the stored
735735
/// object if there is one.
@@ -763,7 +763,7 @@ class optional : private detail::optional_move_assign_base<T>,
763763
: result(nullopt);
764764
}
765765

766-
# ifndef TL_OPTIONAL_NO_CONSTRR
766+
#ifndef TL_OPTIONAL_NO_CONSTRR
767767
template<class F>
768768
constexpr detail::invoke_result_t<F, const T&&> and_then(F&& f) const&& {
769769
using result = detail::invoke_result_t<F, const T&&>;
@@ -773,7 +773,7 @@ class optional : private detail::optional_move_assign_base<T>,
773773
return has_value() ? detail::invoke(std::forward<F>(f), std::move(**this))
774774
: result(nullopt);
775775
}
776-
# endif
776+
#endif
777777
#endif
778778

779779
#if defined(TL_OPTIONAL_CXX14) && !defined(TL_OPTIONAL_GCC49) && !defined(TL_OPTIONAL_GCC54) && !defined(TL_OPTIONAL_GCC55)
@@ -820,14 +820,14 @@ class optional : private detail::optional_move_assign_base<T>,
820820
return optional_map_impl(*this, std::forward<F>(f));
821821
}
822822

823-
# ifndef TL_OPTIONAL_NO_CONSTRR
823+
#ifndef TL_OPTIONAL_NO_CONSTRR
824824
template<class F>
825825
constexpr decltype(optional_map_impl(std::declval<const optional&&>(),
826826
std::declval<F&&>()))
827827
map(F&& f) const&& {
828828
return optional_map_impl(std::move(*this), std::forward<F>(f));
829829
}
830-
# endif
830+
#endif
831831
#endif
832832

833833
#if defined(TL_OPTIONAL_CXX14) && !defined(TL_OPTIONAL_GCC49) && !defined(TL_OPTIONAL_GCC54) && !defined(TL_OPTIONAL_GCC55)
@@ -874,14 +874,14 @@ class optional : private detail::optional_move_assign_base<T>,
874874
return optional_map_impl(*this, std::forward<F>(f));
875875
}
876876

877-
# ifndef TL_OPTIONAL_NO_CONSTRR
877+
#ifndef TL_OPTIONAL_NO_CONSTRR
878878
template<class F>
879879
constexpr decltype(optional_map_impl(std::declval<const optional&&>(),
880880
std::declval<F&&>()))
881881
transform(F&& f) const&& {
882882
return optional_map_impl(std::move(*this), std::forward<F>(f));
883883
}
884-
# endif
884+
#endif
885885
#endif
886886

887887
/// Calls `f` if the optional is empty
@@ -1593,7 +1593,7 @@ class optional<T&> {
15931593
: result(nullopt);
15941594
}
15951595

1596-
# ifndef TL_OPTIONAL_NO_CONSTRR
1596+
#ifndef TL_OPTIONAL_NO_CONSTRR
15971597
template<class F>
15981598
constexpr auto and_then(F&& f) const&& {
15991599
using result = detail::invoke_result_t<F, const T&>;
@@ -1603,7 +1603,7 @@ class optional<T&> {
16031603
return has_value() ? detail::invoke(std::forward<F>(f), **this)
16041604
: result(nullopt);
16051605
}
1606-
# endif
1606+
#endif
16071607
#else
16081608
/// Carries out some operation which returns an optional on the stored
16091609
/// object if there is one.
@@ -1637,7 +1637,7 @@ class optional<T&> {
16371637
: result(nullopt);
16381638
}
16391639

1640-
# ifndef TL_OPTIONAL_NO_CONSTRR
1640+
#ifndef TL_OPTIONAL_NO_CONSTRR
16411641
template<class F>
16421642
constexpr detail::invoke_result_t<F, const T&> and_then(F&& f) const&& {
16431643
using result = detail::invoke_result_t<F, const T&>;
@@ -1647,7 +1647,7 @@ class optional<T&> {
16471647
return has_value() ? detail::invoke(std::forward<F>(f), **this)
16481648
: result(nullopt);
16491649
}
1650-
# endif
1650+
#endif
16511651
#endif
16521652

16531653
#if defined(TL_OPTIONAL_CXX14) && !defined(TL_OPTIONAL_GCC49) && !defined(TL_OPTIONAL_GCC54) && !defined(TL_OPTIONAL_GCC55)
@@ -1694,14 +1694,14 @@ class optional<T&> {
16941694
return detail::optional_map_impl(*this, std::forward<F>(f));
16951695
}
16961696

1697-
# ifndef TL_OPTIONAL_NO_CONSTRR
1697+
#ifndef TL_OPTIONAL_NO_CONSTRR
16981698
template<class F>
16991699
constexpr decltype(detail::optional_map_impl(std::declval<const optional&&>(),
17001700
std::declval<F&&>()))
17011701
map(F&& f) const&& {
17021702
return detail::optional_map_impl(std::move(*this), std::forward<F>(f));
17031703
}
1704-
# endif
1704+
#endif
17051705
#endif
17061706

17071707
#if defined(TL_OPTIONAL_CXX14) && !defined(TL_OPTIONAL_GCC49) && !defined(TL_OPTIONAL_GCC54) && !defined(TL_OPTIONAL_GCC55)
@@ -1750,14 +1750,14 @@ class optional<T&> {
17501750
return detail::optional_map_impl(*this, std::forward<F>(f));
17511751
}
17521752

1753-
# ifndef TL_OPTIONAL_NO_CONSTRR
1753+
#ifndef TL_OPTIONAL_NO_CONSTRR
17541754
template<class F>
17551755
constexpr decltype(detail::optional_map_impl(std::declval<const optional&&>(),
17561756
std::declval<F&&>()))
17571757
transform(F&& f) const&& {
17581758
return detail::optional_map_impl(std::move(*this), std::forward<F>(f));
17591759
}
1760-
# endif
1760+
#endif
17611761
#endif
17621762

17631763
/// Calls `f` if the optional is empty

0 commit comments

Comments
 (0)