From 096be1663682f38d572e9816e3350e0dc9f13168 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sat, 20 Jan 2018 00:48:02 -0700 Subject: Format: Run the new clang format on everything --- src/common/bit_set.h | 2 +- src/common/chunk_file.h | 5 ++- src/common/color.h | 2 +- src/common/file_util.cpp | 17 ++++----- src/common/file_util.h | 2 +- src/common/logging/backend.cpp | 2 +- src/common/logging/backend.h | 2 +- src/common/logging/filter.cpp | 2 +- src/common/logging/filter.h | 2 +- src/common/logging/text_formatter.cpp | 2 +- src/common/logging/text_formatter.h | 2 +- src/common/memory_util.cpp | 7 ++-- src/common/quaternion.h | 2 +- src/common/scm_rev.h | 2 +- src/common/scope_exit.h | 2 +- src/common/string_util.cpp | 4 +- src/common/string_util.h | 2 +- src/common/thread_queue_list.h | 2 +- src/common/x64/xbyak_abi.h | 69 ++++++++++++++++++++++++++++------- 19 files changed, 87 insertions(+), 43 deletions(-) (limited to 'src/common') diff --git a/src/common/bit_set.h b/src/common/bit_set.h index 9c2e6b28c..84e3cbe58 100644 --- a/src/common/bit_set.h +++ b/src/common/bit_set.h @@ -236,7 +236,7 @@ public: IntTy m_val; }; -} // Common +} // namespace Common typedef Common::BitSet BitSet8; typedef Common::BitSet BitSet16; diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index 5145a3657..972ef9039 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -607,8 +607,9 @@ public: u32 cookie = arbitraryNumber; Do(cookie); if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) { - LOG_ERROR(Common, "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). " - "Aborting savestate load...", + LOG_ERROR(Common, + "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). " + "Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); SetError(ERROR_FAILURE); } diff --git a/src/common/color.h b/src/common/color.h index 4ebd4f3d0..24a445dac 100644 --- a/src/common/color.h +++ b/src/common/color.h @@ -256,4 +256,4 @@ inline void EncodeX24S8(u8 stencil, u8* bytes) { bytes[3] = stencil; } -} // namespace +} // namespace Color diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 5ab036b34..4e1d702f7 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -873,20 +873,19 @@ bool IOFile::Flush() { } bool IOFile::Resize(u64 size) { - if (!IsOpen() || - 0 != + if (!IsOpen() || 0 != #ifdef _WIN32 - // ector: _chsize sucks, not 64-bit safe - // F|RES: changed to _chsize_s. i think it is 64-bit safe - _chsize_s(_fileno(m_file), size) + // ector: _chsize sucks, not 64-bit safe + // F|RES: changed to _chsize_s. i think it is 64-bit safe + _chsize_s(_fileno(m_file), size) #else - // TODO: handle 64bit and growing - ftruncate(fileno(m_file), size) + // TODO: handle 64bit and growing + ftruncate(fileno(m_file), size) #endif - ) + ) m_good = false; return m_good; } -} // namespace +} // namespace FileUtil diff --git a/src/common/file_util.h b/src/common/file_util.h index 94adfcd7e..630232a25 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -253,7 +253,7 @@ private: bool m_good = true; }; -} // namespace +} // namespace FileUtil // To deal with Windows being dumb at unicode: template diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index ba0acfb72..e136482b6 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -132,4 +132,4 @@ void LogMessage(Class log_class, Level log_level, const char* filename, unsigned PrintColoredMessage(entry); } -} +} // namespace Log diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index c4fe2acbf..70744e3e5 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h @@ -47,4 +47,4 @@ Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsign const char* function, const char* format, va_list args); void SetFilter(Filter* filter); -} +} // namespace Log diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 12e5bb45d..733247b51 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -94,4 +94,4 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin, bool Filter::CheckMessage(Class log_class, Level level) const { return static_cast(level) >= static_cast(class_levels[static_cast(log_class)]); } -} +} // namespace Log diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h index b51df61de..16fa72642 100644 --- a/src/common/logging/filter.h +++ b/src/common/logging/filter.h @@ -50,4 +50,4 @@ public: private: std::array class_levels; }; -} +} // namespace Log diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index f71e748d1..e7e46c76b 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -129,4 +129,4 @@ void PrintColoredMessage(const Entry& entry) { #undef ESC #endif } -} +} // namespace Log diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h index 749268310..66e86d9ec 100644 --- a/src/common/logging/text_formatter.h +++ b/src/common/logging/text_formatter.h @@ -28,4 +28,4 @@ void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len); void PrintMessage(const Entry& entry); /// Prints the same message as `PrintMessage`, but colored acoording to the severity level. void PrintColoredMessage(const Entry& entry); -} +} // namespace Log diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index c19729b21..759ad02ca 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -40,11 +40,12 @@ void* AllocateExecutableMemory(size_t size, bool low) { if (low && (!map_hint)) map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */ #endif - void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE + void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_ANON | MAP_PRIVATE #if defined(ARCHITECTURE_X64) && defined(MAP_32BIT) - | (low ? MAP_32BIT : 0) + | (low ? MAP_32BIT : 0) #endif - , + , -1, 0); #endif /* defined(_WIN32) */ diff --git a/src/common/quaternion.h b/src/common/quaternion.h index 77f626bcb..ea39298c1 100644 --- a/src/common/quaternion.h +++ b/src/common/quaternion.h @@ -46,4 +46,4 @@ inline Quaternion MakeQuaternion(const Math::Vec3& axis, float ang return {axis * std::sin(angle / 2), std::cos(angle / 2)}; } -} // namspace Math +} // namespace Math diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index 18aaa1735..db0f4a947 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h @@ -12,4 +12,4 @@ extern const char g_scm_desc[]; extern const char g_build_name[]; extern const char g_build_date[]; -} // namespace +} // namespace Common diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 072ab285d..baf1f1c9e 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -22,7 +22,7 @@ template ScopeExitHelper ScopeExit(Func&& func) { return ScopeExitHelper(std::move(func)); } -} +} // namespace detail /** * This macro allows you to conveniently specify a block of code that will run on scope exit. Handy diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 6959915fa..e9a2a6b00 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -202,7 +202,7 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ #ifdef _WIN32 ":" #endif - ); + ); if (std::string::npos == dir_end) dir_end = 0; else @@ -462,4 +462,4 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_l return std::string(buffer, len); } -} +} // namespace Common diff --git a/src/common/string_util.h b/src/common/string_util.h index 259360aec..ceb8df48e 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -134,4 +134,4 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) { * NUL-terminated then the string ends at max_len characters. */ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len); -} +} // namespace Common diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index edd0e4a3f..38a450d69 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -158,4 +158,4 @@ private: std::array queues; }; -} // namespace +} // namespace Common diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h index 6090d93e1..fd3fbdd4b 100644 --- a/src/common/x64/xbyak_abi.h +++ b/src/common/x64/xbyak_abi.h @@ -60,20 +60,41 @@ const Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9; const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({ // GPRs - Xbyak::util::rcx, Xbyak::util::rdx, Xbyak::util::r8, Xbyak::util::r9, Xbyak::util::r10, + Xbyak::util::rcx, + Xbyak::util::rdx, + Xbyak::util::r8, + Xbyak::util::r9, + Xbyak::util::r10, Xbyak::util::r11, // XMMs - Xbyak::util::xmm0, Xbyak::util::xmm1, Xbyak::util::xmm2, Xbyak::util::xmm3, Xbyak::util::xmm4, + Xbyak::util::xmm0, + Xbyak::util::xmm1, + Xbyak::util::xmm2, + Xbyak::util::xmm3, + Xbyak::util::xmm4, Xbyak::util::xmm5, }); const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ // GPRs - Xbyak::util::rbx, Xbyak::util::rsi, Xbyak::util::rdi, Xbyak::util::rbp, Xbyak::util::r12, - Xbyak::util::r13, Xbyak::util::r14, Xbyak::util::r15, + Xbyak::util::rbx, + Xbyak::util::rsi, + Xbyak::util::rdi, + Xbyak::util::rbp, + Xbyak::util::r12, + Xbyak::util::r13, + Xbyak::util::r14, + Xbyak::util::r15, // XMMs - Xbyak::util::xmm6, Xbyak::util::xmm7, Xbyak::util::xmm8, Xbyak::util::xmm9, Xbyak::util::xmm10, - Xbyak::util::xmm11, Xbyak::util::xmm12, Xbyak::util::xmm13, Xbyak::util::xmm14, + Xbyak::util::xmm6, + Xbyak::util::xmm7, + Xbyak::util::xmm8, + Xbyak::util::xmm9, + Xbyak::util::xmm10, + Xbyak::util::xmm11, + Xbyak::util::xmm12, + Xbyak::util::xmm13, + Xbyak::util::xmm14, Xbyak::util::xmm15, }); @@ -90,18 +111,40 @@ const Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx; const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({ // GPRs - Xbyak::util::rcx, Xbyak::util::rdx, Xbyak::util::rdi, Xbyak::util::rsi, Xbyak::util::r8, - Xbyak::util::r9, Xbyak::util::r10, Xbyak::util::r11, + Xbyak::util::rcx, + Xbyak::util::rdx, + Xbyak::util::rdi, + Xbyak::util::rsi, + Xbyak::util::r8, + Xbyak::util::r9, + Xbyak::util::r10, + Xbyak::util::r11, // XMMs - Xbyak::util::xmm0, Xbyak::util::xmm1, Xbyak::util::xmm2, Xbyak::util::xmm3, Xbyak::util::xmm4, - Xbyak::util::xmm5, Xbyak::util::xmm6, Xbyak::util::xmm7, Xbyak::util::xmm8, Xbyak::util::xmm9, - Xbyak::util::xmm10, Xbyak::util::xmm11, Xbyak::util::xmm12, Xbyak::util::xmm13, - Xbyak::util::xmm14, Xbyak::util::xmm15, + Xbyak::util::xmm0, + Xbyak::util::xmm1, + Xbyak::util::xmm2, + Xbyak::util::xmm3, + Xbyak::util::xmm4, + Xbyak::util::xmm5, + Xbyak::util::xmm6, + Xbyak::util::xmm7, + Xbyak::util::xmm8, + Xbyak::util::xmm9, + Xbyak::util::xmm10, + Xbyak::util::xmm11, + Xbyak::util::xmm12, + Xbyak::util::xmm13, + Xbyak::util::xmm14, + Xbyak::util::xmm15, }); const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ // GPRs - Xbyak::util::rbx, Xbyak::util::rbp, Xbyak::util::r12, Xbyak::util::r13, Xbyak::util::r14, + Xbyak::util::rbx, + Xbyak::util::rbp, + Xbyak::util::r12, + Xbyak::util::r13, + Xbyak::util::r14, Xbyak::util::r15, }); -- cgit v1.2.3