[PATCH] D58520: [Subtarget] Remove static global constructor call from the tablegened subtarget feature tables

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 10:50:33 PST 2019


bjope added inline comments.


================
Comment at: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp:185
+
+  OS << "{ { ";
+  for (unsigned i = 0; i != Mask.size(); ++i) {
----------------
bjope wrote:
> @craig.topper, I see lots of warning when compiling using clang 3.6 after this patch:
> ```
> lib/Target/AArch64/AArch64GenSubtargetInfo.inc:167:63: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
>   { "a35", "Cortex-A35 ARM processors", AArch64::ProcA35, { { 0x20800080800800ULL, 0x0ULL, 0x0ULL, } } },
>                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                                                                {                                  }
> ```
> 
> Adding one more level of braces "{ { { 0x20800080800800ULL, 0x0ULL, 0x0ULL, } } }" seems to work, but would that mean that we no longer run the new constexpr ctor?
Ok, now I've read this: https://en.cppreference.com/w/cpp/container/array

So as described in the example 

```
    std::array<int, 3> a1{ {1, 2, 3} }; // 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)
```
I guess my old clang 3.6 compiler doesn't include CWG 1270 then.

Afaict clang 3.6 should still be supported (even if I don't know how many warnings that are accepted when building).
Should we simply generate the double braces here, to work around these warnings? 


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58520/new/

https://reviews.llvm.org/D58520





More information about the llvm-commits mailing list