From 3b8e3a97147de8a735dadc50250b50527a71205b Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 29 Nov 2020 15:03:50 +0300 Subject: [PATCH] stdafx.h: remove BOM from custom included headers Also add warnings about adding them. --- Utilities/BEType.h | 5 +---- Utilities/File.h | 2 +- Utilities/StrFmt.h | 2 +- Utilities/types.h | 2 +- rpcs3/stdafx.cpp | 4 ++++ rpcs3/stdafx.h | 2 +- rpcs3/util/atomic.hpp | 2 +- rpcs3/util/endian.hpp | 5 +---- rpcs3/util/logs.hpp | 2 +- rpcs3/util/shared_ptr.hpp | 8 +++++--- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 7fb9d35bb..23bc07db7 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -1,5 +1,4 @@ -#ifndef BETYPE_H_GUARD -#define BETYPE_H_GUARD +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include "types.h" #include "util/endian.hpp" @@ -510,5 +509,3 @@ struct fmt_unveil, void> static_assert(be_t(1) + be_t(2) + be_t(3) == 6); static_assert(le_t(1) + le_t(2) + le_t(3) == 6); - -#endif // BETYPE_H_GUARD diff --git a/Utilities/File.h b/Utilities/File.h index cdaa1085a..c4b53cd35 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include "types.h" #include "bit_set.h" diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 33b4b6473..4a921d3b5 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include "types.h" diff --git a/Utilities/types.h b/Utilities/types.h index c31b12f6c..8f25f04e9 100644 --- a/Utilities/types.h +++ b/Utilities/types.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #ifdef _MSC_VER #include diff --git a/rpcs3/stdafx.cpp b/rpcs3/stdafx.cpp index fd4f341c7..77f28c49f 100644 --- a/rpcs3/stdafx.cpp +++ b/rpcs3/stdafx.cpp @@ -1 +1,5 @@ +// No BOM and only basic ASCII in this file, or a neko will die #include "stdafx.h" + +static_assert(be_t(1) + be_t(2) + be_t(3) == 6); +static_assert(le_t(1) + le_t(2) + le_t(3) == 6); diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index 09db940f0..1340faee0 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #ifdef MSVC_CRT_MEMLEAK_DETECTION #define _CRTDBG_MAP_ALLOC diff --git a/rpcs3/util/atomic.hpp b/rpcs3/util/atomic.hpp index 5035c8808..32e1a52b2 100644 --- a/rpcs3/util/atomic.hpp +++ b/rpcs3/util/atomic.hpp @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include "Utilities/types.h" #include diff --git a/rpcs3/util/endian.hpp b/rpcs3/util/endian.hpp index a3d39b271..b7cbcd913 100644 --- a/rpcs3/util/endian.hpp +++ b/rpcs3/util/endian.hpp @@ -1,5 +1,4 @@ -#ifndef ENDIAN_HPP_GUARD -#define ENDIAN_HPP_GUARD +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include #include "Utilities/types.h" @@ -492,5 +491,3 @@ public: } }; } - -#endif // ENDIAN_HPP_GUARD diff --git a/rpcs3/util/logs.hpp b/rpcs3/util/logs.hpp index 0cc882861..cd6891aa5 100644 --- a/rpcs3/util/logs.hpp +++ b/rpcs3/util/logs.hpp @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include #include diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index 7f31cc9db..21b03e39e 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -1,4 +1,4 @@ -#pragma once +#pragma once // No BOM and only basic ASCII in this header, or a neko will die #include #include @@ -9,10 +9,12 @@ namespace stx template constexpr bool is_same_ptr() noexcept { - // Should be possible if constexpr bit_cast is available? + // I would like to make it a trait if there is some trick. + // And believe it shall possible with constexpr bit_cast. // Otherwise I hope it will compile in null code anyway. const auto u = reinterpret_cast(0x11223344556); - return static_cast(u) == static_cast(u); + const volatile void* x = u; + return static_cast(u) == x; } // TODO