Chromium Code Reviews| Index: util/misc/struct_pack.h |
| diff --git a/util/test/executable_path_win.cc b/util/misc/struct_pack.h |
| similarity index 54% |
| copy from util/test/executable_path_win.cc |
| copy to util/misc/struct_pack.h |
| index 024478d7552d5a0a3cdb03e5f686d193549b2ee3..55ecbda00efc0b82c19a493e0532a2064fffc753 100644 |
| --- a/util/test/executable_path_win.cc |
| +++ b/util/misc/struct_pack.h |
| @@ -12,18 +12,19 @@ |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| -#include "util/test/executable_path.h" |
| +#ifndef CRASHPAD_UTIL_MISC_STRUCT_PACK_H_ |
| +#define CRASHPAD_UTIL_MISC_STRUCT_PACK_H_ |
| -#include <windows.h> |
| +#include "base/compiler_specific.h" |
| -namespace crashpad { |
| -namespace test { |
| +#if defined(COMPILER_MSVC) |
| +#define PACK_AND_ALIGN_N(decl, N) \ |
| + __pragma(pack(push, 1)) __declspec(align(N)) decl __pragma(pack(pop)) |
| +#else |
| +#define PACK_AND_ALIGN_N(decl, N) decl __attribute__((packed, aligned(N))) |
|
Mark Mentovai
2015/02/02 22:10:28
If you wind up with an #if defined(DOXYGEN) branch
|
| +#endif // COMPILER_MSVC |
| -base::FilePath ExecutablePath() { |
| - wchar_t executable_path[_MAX_PATH]; |
| - GetModuleFileName(nullptr, executable_path, sizeof(executable_path)); |
| - return base::FilePath(executable_path); |
| -} |
| +#define PACK_AND_ALIGN_4(decl) PACK_AND_ALIGN_N(decl, 4) |
| +#define PACK_AND_ALIGN_16(decl) PACK_AND_ALIGN_N(decl, 16) |
| -} // namespace test |
| -} // namespace crashpad |
| +#endif // CRASHPAD_UTIL_MISC_STRUCT_PACK_H_ |