[PATCH] D60646: [lld] Add double-braces for std::array to suppress warnings. NFC.
Xing via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 13 00:26:28 PDT 2019
Higuoxing created this revision.
Higuoxing added a reviewer: ruiu.
Herald added subscribers: llvm-commits, MaskRay, kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
This patch helps suppress warnings when building lld.
According to https://en.cppreference.com/w/cpp/container/array, double-braces required in C++11 prior to the CWG 1270 revision
(not needed in C++11 after the revision and in C++14 and beyond)
/Users/me/Workspace/llvm/llvm-project/lld/ELF/Arch/MSP430.cpp:44:16: warning: suggest braces around initialization of subobject [-Wmissing-braces]
TrapInstr = {0x43, 0x43, 0x43, 0x43};
^~~~~~~~~~~~~~~~~~~~~~
{ }
1 warning generated.
[4/9] Building CXX object tools/lld/ELF/CMakeFiles/lldELF.dir/Arch/ARM.cpp.o
/Users/me/Workspace/llvm/llvm-project/lld/ELF/Arch/ARM.cpp:63:16: warning: suggest braces around initialization of subobject [-Wmissing-braces]
TrapInstr = {0xd4, 0xd4, 0xd4, 0xd4};
^~~~~~~~~~~~~~~~~~~~~~
{ }
1 warning generated.
[5/9] Building CXX object tools/lld/ELF/CMakeFiles/lldELF.dir/Arch/X86.cpp.o
/Users/me/Workspace/llvm/llvm-project/lld/ELF/Arch/X86.cpp:62:16: warning: suggest braces around initialization of subobject [-Wmissing-braces]
TrapInstr = {0xcc, 0xcc, 0xcc, 0xcc}; // 0xcc = INT3
^~~~~~~~~~~~~~~~~~~~~~
{ }
1 warning generated.
[6/9] Building CXX object tools/lld/ELF/CMakeFiles/lldELF.dir/Arch/X86_64.cpp.o
/Users/me/Workspace/llvm/llvm-project/lld/ELF/Arch/X86_64.cpp:65:16: warning: suggest braces around initialization of subobject [-Wmissing-braces]
TrapInstr = {0xcc, 0xcc, 0xcc, 0xcc}; // 0xcc = INT3
^~~~~~~~~~~~~~~~~~~~~~
{ }
1 warning generated.
[7/9] Building CXX object tools/lld/ELF/CMakeFiles/lldELF.dir/OutputSections.cpp.o
/Users/me/Workspace/llvm/llvm-project/lld/ELF/OutputSections.cpp:412:11: warning: suggest braces around initialization of subobject [-Wmissing-braces]
return {0, 0, 0, 0};
^~~~~~~~~~
{ }
1 warning generated.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60646
Files:
lld/ELF/Arch/ARM.cpp
lld/ELF/Arch/MSP430.cpp
lld/ELF/Arch/X86.cpp
lld/ELF/Arch/X86_64.cpp
lld/ELF/OutputSections.cpp
Index: lld/ELF/OutputSections.cpp
===================================================================
--- lld/ELF/OutputSections.cpp
+++ lld/ELF/OutputSections.cpp
@@ -409,7 +409,7 @@
return *Filler;
if (Flags & SHF_EXECINSTR)
return Target->TrapInstr;
- return {0, 0, 0, 0};
+ return {{0, 0, 0, 0}};
}
template void OutputSection::writeHeaderTo<ELF32LE>(ELF32LE::Shdr *Shdr);
Index: lld/ELF/Arch/X86_64.cpp
===================================================================
--- lld/ELF/Arch/X86_64.cpp
+++ lld/ELF/Arch/X86_64.cpp
@@ -62,7 +62,7 @@
GotPltEntrySize = 8;
PltEntrySize = 16;
PltHeaderSize = 16;
- TrapInstr = {0xcc, 0xcc, 0xcc, 0xcc}; // 0xcc = INT3
+ TrapInstr = {{0xcc, 0xcc, 0xcc, 0xcc}}; // 0xcc = INT3
// Align to the large page size (known as a superpage or huge page).
// FreeBSD automatically promotes large, superpage-aligned allocations.
Index: lld/ELF/Arch/X86.cpp
===================================================================
--- lld/ELF/Arch/X86.cpp
+++ lld/ELF/Arch/X86.cpp
@@ -59,7 +59,7 @@
GotPltEntrySize = 4;
PltEntrySize = 16;
PltHeaderSize = 16;
- TrapInstr = {0xcc, 0xcc, 0xcc, 0xcc}; // 0xcc = INT3
+ TrapInstr = {{0xcc, 0xcc, 0xcc, 0xcc}}; // 0xcc = INT3
// Align to the non-PAE large page size (known as a superpage or huge page).
// FreeBSD automatically promotes large, superpage-aligned allocations.
Index: lld/ELF/Arch/MSP430.cpp
===================================================================
--- lld/ELF/Arch/MSP430.cpp
+++ lld/ELF/Arch/MSP430.cpp
@@ -41,7 +41,7 @@
MSP430::MSP430() {
// mov.b #0, r3
- TrapInstr = {0x43, 0x43, 0x43, 0x43};
+ TrapInstr = {{0x43, 0x43, 0x43, 0x43}};
}
RelExpr MSP430::getRelExpr(RelType Type, const Symbol &S,
Index: lld/ELF/Arch/ARM.cpp
===================================================================
--- lld/ELF/Arch/ARM.cpp
+++ lld/ELF/Arch/ARM.cpp
@@ -60,7 +60,7 @@
GotPltEntrySize = 4;
PltEntrySize = 16;
PltHeaderSize = 32;
- TrapInstr = {0xd4, 0xd4, 0xd4, 0xd4};
+ TrapInstr = {{0xd4, 0xd4, 0xd4, 0xd4}};
NeedsThunks = true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60646.195002.patch
Type: text/x-patch
Size: 2112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190413/8210765c/attachment.bin>
More information about the llvm-commits
mailing list