Chromium Code Reviews| Index: minidump/minidump_extensions.h |
| diff --git a/minidump/minidump_extensions.h b/minidump/minidump_extensions.h |
| index a82d2f96562e522e5f42121ab7951b19d6cd3425..46284f8b4f316d54eab27a727677a8f189db1fb9 100644 |
| --- a/minidump/minidump_extensions.h |
| +++ b/minidump/minidump_extensions.h |
| @@ -15,12 +15,21 @@ |
| #ifndef CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |
| #define CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |
| -#include <dbghelp.h> |
| #include <stdint.h> |
| -#include <winnt.h> |
| +#include "base/compiler_specific.h" |
| +#include "build/build_config.h" |
| +#include "minidump/crashpad_dbghelp.h" |
| +#include "minidump/crashpad_winnt.h" |
| #include "util/misc/uuid.h" |
| +#if defined(COMPILER_MSVC) |
| +#define PACKED |
| +#pragma pack(push, 1) |
|
Mark Mentovai
2015/02/03 18:26:32
This is going to suck if we want a non-packed stru
scottmg
2015/02/03 19:22:44
Agreed.
|
| +#else |
| +#define PACKED __attribute((packed)) |
| +#endif // COMPILER_MSVC |
| + |
| namespace crashpad { |
| //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each |
| @@ -69,7 +78,7 @@ enum MinidumpStreamType : uint32_t { |
| //! file. |
| //! |
| //! \sa MINIDUMP_STRING |
| -struct __attribute__((packed, aligned(4))) MinidumpUTF8String { |
| +struct ALIGNAS(4) PACKED MinidumpUTF8String { |
| // The field names do not conform to typical style, they match the names used |
| // in MINIDUMP_STRING. This makes it easier to operate on MINIDUMP_STRING (for |
| // UTF-16 strings) and MinidumpUTF8String using templates. |
| @@ -297,16 +306,16 @@ struct MinidumpModuleCodeViewRecordPDB70 { |
| }; |
| //! \brief A list of ::RVA pointers. |
| -struct __attribute__((packed, aligned(4))) MinidumpRVAList { |
| +struct ALIGNAS(4) PACKED MinidumpRVAList { |
| //! \brief The number of children present in the #children array. |
| uint32_t count; |
| //! \brief Pointers to other structures in the minidump file. |
| RVA children[0]; |
| -}; |
| +); |
|
Mark Mentovai
2015/02/03 18:26:32
Make this a } again.
|
| //! \brief A list of MINIDUMP_LOCATION_DESCRIPTOR objects. |
| -struct __attribute__((packed, aligned(4))) MinidumpLocationDescriptorList { |
| +struct ALIGNAS(4) PACKED MinidumpLocationDescriptorList { |
| //! \brief The number of children present in the #children array. |
| uint32_t count; |
| @@ -315,7 +324,7 @@ struct __attribute__((packed, aligned(4))) MinidumpLocationDescriptorList { |
| }; |
| //! \brief A key-value pair. |
| -struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionaryEntry { |
| +struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionaryEntry { |
| //! \brief ::RVA of a MinidumpUTF8String containing the key of a key-value |
| //! pair. |
| RVA key; |
| @@ -326,7 +335,7 @@ struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionaryEntry { |
| }; |
| //! \brief A list of key-value pairs. |
| -struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionary { |
| +struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionary { |
| //! \brief The number of key-value pairs present. |
| uint32_t count; |
| @@ -349,7 +358,7 @@ struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionary { |
| //! fields are valid or not. |
| //! |
| //! \sa #MinidumpModuleCrashpadInfoList |
| -struct __attribute__((packed, aligned(4))) MinidumpModuleCrashpadInfo { |
| +struct ALIGNAS(4) PACKED MinidumpModuleCrashpadInfo { |
| //! \brief The structure’s currently-defined version number. |
| //! |
| //! \sa version |
| @@ -422,7 +431,7 @@ using MinidumpModuleCrashpadInfoList = MinidumpLocationDescriptorList; |
| //! structure. Revise #kVersion and document each field’s validity based on |
| //! #version, so that newer parsers will be able to determine whether the added |
| //! fields are valid or not. |
| -struct __attribute__((packed, aligned(4))) MinidumpCrashpadInfo { |
| +struct ALIGNAS(4) PACKED MinidumpCrashpadInfo { |
| //! \brief The structure’s currently-defined version number. |
| //! |
| //! \sa version |
| @@ -445,6 +454,11 @@ struct __attribute__((packed, aligned(4))) MinidumpCrashpadInfo { |
| MINIDUMP_LOCATION_DESCRIPTOR module_list; |
| }; |
| +#if defined(COMPILER_MSVC) |
| +#pragma pack(pop) |
| +#endif // COMPILER_MSVC |
| +#undef PACKED |
| + |
| } // namespace crashpad |
| #endif // CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |