Merge pull request #440 from Danielmelody/master

Using push/pop in all pragma pack pair to avoid potential padding bugs
This commit is contained in:
Bartosz Taudul 2022-08-03 13:36:47 +02:00 committed by GitHub
commit fc7b3c3c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 15 deletions

View File

@ -34,7 +34,7 @@ enum HandshakeStatus : uint8_t
enum { WelcomeMessageProgramNameSize = 64 };
enum { WelcomeMessageHostInfoSize = 1024 };
#pragma pack( 1 )
#pragma pack( push, 1 )
// Must increase left query space after handling!
enum ServerQuery : uint8_t
@ -133,7 +133,7 @@ struct BroadcastMessage
enum { BroadcastMessageSize = sizeof( BroadcastMessage ) };
#pragma pack()
#pragma pack( pop )
}

View File

@ -122,7 +122,7 @@ enum class QueueType : uint8_t
NUM_TYPES
};
#pragma pack( 1 )
#pragma pack( push, 1 )
struct QueueThreadContext
{
@ -745,7 +745,7 @@ struct QueueItem
QueueFiberLeave fiberLeave;
};
};
#pragma pack()
#pragma pack( pop )
enum { QueueItemSize = sizeof( QueueItem ) };

View File

@ -114,7 +114,7 @@ struct THREADNAME_INFO
DWORD dwThreadID;
DWORD dwFlags;
};
# pragma pack(pop)
# pragma pack( pop )
void ThreadNameMsvcMagic( const THREADNAME_INFO& info )
{

View File

@ -18,7 +18,7 @@
namespace tracy
{
#pragma pack( 1 )
#pragma pack( push, 1 )
struct StringRef
{
@ -663,7 +663,7 @@ struct ChildSample
enum { ChildSampleSize = sizeof( ChildSample ) };
#pragma pack()
#pragma pack( pop )
struct ThreadData

View File

@ -7,7 +7,7 @@
namespace tracy
{
#pragma pack( 1 )
#pragma pack( push, 1 )
template<typename T, class CompareDefault = std::less<T>>
class SortedVector
{
@ -118,7 +118,7 @@ private:
uint32_t sortedEnd;
};
#pragma pack()
#pragma pack( pop )
enum { SortedVectorSize = sizeof( SortedVector<int> ) };

View File

@ -16,7 +16,7 @@
namespace tracy
{
#pragma pack( 1 )
#pragma pack( push, 1 )
template<typename T>
class VarArray
{
@ -56,7 +56,7 @@ private:
uint32_t m_hash;
const short_ptr<T> m_ptr;
};
#pragma pack()
#pragma pack( pop )
enum { VarArraySize = sizeof( VarArray<int> ) };

View File

@ -19,7 +19,7 @@
namespace tracy
{
#pragma pack( 1 )
#pragma pack( push, 1 )
template<typename T>
class Vector
{
@ -348,7 +348,7 @@ private:
template<typename T> struct VectorAdapterDirect { const T& operator()( const T& it ) const { return it; } };
template<typename T> struct VectorAdapterPointer { const T& operator()( const short_ptr<T>& it ) const { return *it; } };
#pragma pack()
#pragma pack( pop )
enum { VectorSize = sizeof( Vector<int> ) };

View File

@ -158,13 +158,13 @@ public:
uint8_t inlineFrame;
};
#pragma pack( 1 )
#pragma pack( push, 1 )
struct GhostKey
{
CallstackFrameId frame;
uint8_t inlineFrame;
};
#pragma pack()
#pragma pack( pop )
struct GhostKeyHasher
{