aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-09-25 08:23:32 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-09-25 08:23:32 +0200
commitcf42c36e9963f9cf13704d8d74a9546f0db33d40 (patch)
tree858c8076671647abe299b1ef0125b7476006f726 /src/compat
parentea69592a2f261dba37d551c0ac77e93ce00b37c3 (diff)
downloadbitcoin-cf42c36e9963f9cf13704d8d74a9546f0db33d40.tar.xz
Apply clang-format on crypto/* and compat/*
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/glibc_compat.cpp4
-rw-r--r--src/compat/glibc_sanity.cpp14
-rw-r--r--src/compat/glibcxx_compat.cpp19
-rw-r--r--src/compat/glibcxx_sanity.cpp24
4 files changed, 28 insertions, 33 deletions
diff --git a/src/compat/glibc_compat.cpp b/src/compat/glibc_compat.cpp
index 22f82e4259..94c79e4b97 100644
--- a/src/compat/glibc_compat.cpp
+++ b/src/compat/glibc_compat.cpp
@@ -18,11 +18,11 @@ extern "C" void* memcpy(void* a, const void* b, size_t c)
return memmove(a, b, c);
}
-extern "C" void __chk_fail (void) __attribute__((__noreturn__));
+extern "C" void __chk_fail(void) __attribute__((__noreturn__));
extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a)
{
if (a >= FD_SETSIZE)
- __chk_fail ();
+ __chk_fail();
return a / __NFDBITS;
}
extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));
diff --git a/src/compat/glibc_sanity.cpp b/src/compat/glibc_sanity.cpp
index d93602e0fe..acc7809d77 100644
--- a/src/compat/glibc_sanity.cpp
+++ b/src/compat/glibc_sanity.cpp
@@ -14,10 +14,11 @@
extern "C" void* memcpy(void* a, const void* b, size_t c);
void* memcpy_int(void* a, const void* b, size_t c)
{
- return memcpy(a,b,c);
+ return memcpy(a, b, c);
}
-namespace {
+namespace
+{
// trigger: Use the memcpy_int wrapper which calls our internal memcpy.
// A direct call to memcpy may be optimized away by the compiler.
// test: Fill an array with a sequence of integers. memcpy to a new empty array.
@@ -31,11 +32,10 @@ bool sanity_test_memcpy()
for (unsigned int i = 0; i != T; ++i)
memcpy_test[i] = i;
- memcpy_int(memcpy_verify,memcpy_test,sizeof(memcpy_test));
+ memcpy_int(memcpy_verify, memcpy_test, sizeof(memcpy_test));
- for (unsigned int i = 0; i != T; ++i)
- {
- if(memcpy_verify[i] != i)
+ for (unsigned int i = 0; i != T; ++i) {
+ if (memcpy_verify[i] != i)
return false;
}
return true;
@@ -51,7 +51,7 @@ bool sanity_test_fdelt()
fd_set fds;
FD_ZERO(&fds);
FD_SET(0, &fds);
- return FD_ISSET(0,&fds);
+ return FD_ISSET(0, &fds);
}
#endif
diff --git a/src/compat/glibcxx_compat.cpp b/src/compat/glibcxx_compat.cpp
index cbe059735b..41d8458cb2 100644
--- a/src/compat/glibcxx_compat.cpp
+++ b/src/compat/glibcxx_compat.cpp
@@ -11,8 +11,8 @@
#define _GLIBCXX_USE_NOEXCEPT throw()
#endif
-namespace std {
-
+namespace std
+{
const char* bad_exception::what() const throw()
{
return "std::bad_exception";
@@ -30,9 +30,8 @@ const char* bad_alloc::what() const throw()
namespace __detail
{
-struct _List_node_base
-{
- void _M_hook(std::__detail::_List_node_base* const __position) throw () __attribute__((used))
+struct _List_node_base {
+ void _M_hook(std::__detail::_List_node_base* const __position) throw() __attribute__((used))
{
_M_next = __position;
_M_prev = __position->_M_prev;
@@ -62,9 +61,9 @@ template ostream& __ostream_insert(ostream&, const char*, streamsize);
template istream& istream::_M_extract(long&);
template istream& istream::_M_extract(unsigned short&);
-out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT { }
+out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {}
-length_error::~length_error() _GLIBCXX_USE_NOEXCEPT { }
+length_error::~length_error() _GLIBCXX_USE_NOEXCEPT {}
// Used with permission.
// See: https://github.com/madlib/madlib/commit/c3db418c0d34d6813608f2137fef1012ce03043d
@@ -85,11 +84,11 @@ void ctype<char>::_M_widen_init() const
}
}
-void __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__));
-void __throw_out_of_range_fmt(const char* err, ...)
+void __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__));
+void __throw_out_of_range_fmt(const char* err, ...)
{
// Safe and over-simplified version. Ignore the format and print it as-is.
__throw_out_of_range(err);
}
-}// namespace std
+} // namespace std
diff --git a/src/compat/glibcxx_sanity.cpp b/src/compat/glibcxx_sanity.cpp
index cd8da4fd67..9b1fefd448 100644
--- a/src/compat/glibcxx_sanity.cpp
+++ b/src/compat/glibcxx_sanity.cpp
@@ -6,15 +6,15 @@
#include <locale>
#include <stdexcept>
-namespace{
-
+namespace
+{
// trigger: use ctype<char>::widen to trigger ctype<char>::_M_widen_init().
// test: convert a char from narrow to wide and back. Verify that the result
// matches the original.
bool sanity_test_widen(char testchar)
{
- const std::ctype<char>& test(std::use_facet< std::ctype<char> >(std::locale()));
- return test.narrow(test.widen(testchar),'b') == testchar;
+ const std::ctype<char>& test(std::use_facet<std::ctype<char> >(std::locale()));
+ return test.narrow(test.widen(testchar), 'b') == testchar;
}
// trigger: use list::push_back and list::pop_back to trigger _M_hook and
@@ -25,14 +25,13 @@ bool sanity_test_list(unsigned int size)
{
std::list<unsigned int> test;
for (unsigned int i = 0; i != size; ++i)
- test.push_back(i+1);
+ test.push_back(i + 1);
if (test.size() != size)
return false;
- while (!test.empty())
- {
- if(test.back() != test.size())
+ while (!test.empty()) {
+ if (test.back() != test.size())
return false;
test.pop_back();
}
@@ -47,15 +46,12 @@ bool sanity_test_list(unsigned int size)
bool sanity_test_range_fmt()
{
std::string test;
- try
- {
+ try {
test.at(1);
- }
- catch (const std::out_of_range&)
- {
+ } catch (const std::out_of_range&) {
return true;
+ } catch (...) {
}
- catch (...){}
return false;
}