[Lldb-commits] [lldb] r280757 - Make LLDB compile on Windows after the reformat.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 14:52:15 PDT 2016


Author: zturner
Date: Tue Sep  6 16:52:14 2016
New Revision: 280757

URL: http://llvm.org/viewvc/llvm-project?rev=280757&view=rev
Log:
Make LLDB compile on Windows after the reformat.

Most of these issues arose as a result of header re-ordering, but
it turned up a real bug, which is that MSVC doesn't support
__attribute__((packed)) or __attribute__((aligned)).  This was
working before because there's a Windows header that #defines
__attribute__(x) to nothing.  We should fix this by removing
that #define entirely, and dealing with the fallout separately
which may turn up even more bugs.

I fixed this by replacing them with the corresponding LLVM
macros which understand how to do these operations on all the
different compilers.

Modified:
    lldb/trunk/include/lldb/Host/windows/AutoHandle.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h

Modified: lldb/trunk/include/lldb/Host/windows/AutoHandle.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/AutoHandle.h?rev=280757&r1=280756&r2=280757&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/AutoHandle.h (original)
+++ lldb/trunk/include/lldb/Host/windows/AutoHandle.h Tue Sep  6 16:52:14 2016
@@ -10,6 +10,8 @@
 #ifndef LLDB_lldb_Host_windows_AutoHandle_h_
 #define LLDB_lldb_Host_windows_AutoHandle_h_
 
+#include "lldb/Host/windows/windows.h"
+
 namespace lldb_private {
 
 class AutoHandle {

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h?rev=280757&r1=280756&r2=280757&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h Tue Sep  6 16:52:14 2016
@@ -13,6 +13,8 @@
 #include <cstddef>
 #include <cstdint>
 
+#include "llvm/Support/Compiler.h"
+
 //---------------------------------------------------------------------------
 // i386 ehframe, dwarf regnums
 //---------------------------------------------------------------------------
@@ -285,14 +287,17 @@ struct YMM {
   YMMReg ymm[16]; // assembled from ymmh and xmm registers
 };
 
+LLVM_PACKED_START
 struct XSAVE_HDR {
   uint64_t xstate_bv; // OS enabled xstate mask to determine the extended states
                       // supported by the processor
   uint64_t reserved1[2];
   uint64_t reserved2[5];
-} __attribute__((packed));
+};
+LLVM_PACKED_END
 
 // x86 extensions to FXSAVE (i.e. for AVX processors)
+LLVM_PACKED_START
 struct XSAVE {
   FXSAVE i387;      // floating point registers typical in i387_fxsave_struct
   XSAVE_HDR header; // The xsave_hdr_struct can be used to determine if the
@@ -300,7 +305,8 @@ struct XSAVE {
   YMMHReg ymmh[16]; // High 16 bytes of each of 16 YMM registers (the low bytes
                     // are in FXSAVE.xmm for compatibility with SSE)
                     // Slot any extensions to the register file here
-} __attribute__((packed, aligned(64)));
+} LLVM_ALIGNAS(64);
+LLVM_PACKED_END
 
 // Floating-point registers
 struct FPR {




More information about the lldb-commits mailing list