1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

MC: rework static_assert to be MSVC compatible

Visual Studio does not permit referencing a structure member as a static field
for sizeof calculations.  Resort to a pointer cast which is compatible across
Visual Studio and other compilers.

llvm-svn: 206445
This commit is contained in:
Saleem Abdulrasool 2014-04-17 06:17:20 +00:00
parent fb0e41f514
commit 59c1f0c309

View File

@ -632,10 +632,8 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) {
// "Define" each section & symbol. This creates section & symbol
// entries in the staging area.
// FIXME: this used to be
// sizeof(COFF::AuxiliaryFile::FileName) == COFF::SymbolSize
// but VS2013 can't compile that.
static_assert(sizeof(COFF::AuxiliaryFile) == COFF::SymbolSize,
static_assert(sizeof(((COFF::AuxiliaryFile *)0)->FileName) == COFF::SymbolSize,
"size mismatch for COFF::AuxiliaryFile::FileName");
for (auto FI = Asm.file_names_begin(), FE = Asm.file_names_end();
FI != FE; ++FI) {