Use constexpr to avoid kNamedGroups initializer

On some Chrome builds on Windows (including the official builds that we
ship) there are dynamic initializers for kNamedGroups in chrome.dll and
chrome_child.dll. Tagging this array with constexpr is guaranteed to
avoid this.

Bug: chromium:341941
Change-Id: I0e4ea0665b8ed9640b76b709dd300416be49e59e
Reviewed-on: https://boringssl-review.googlesource.com/21564
Reviewed-by: Bruce Dawson <brucedawson@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Bruce Dawson 2017-10-10 12:56:54 -07:00 committed by CQ bot account: commit-bot@chromium.org
parent 2450027e59
commit e05b72c257
2 changed files with 9 additions and 1 deletions

View File

@ -238,6 +238,14 @@ UniquePtr<T> MakeUnique(Args &&... args) {
#define PURE_VIRTUAL { abort(); }
#endif
// CONSTEXPR_ARRAY works around a VS 2015 bug where ranged for loops don't work
// on constexpr arrays.
#if defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1910
#define CONSTEXPR_ARRAY const
#else
#define CONSTEXPR_ARRAY constexpr
#endif
// Array<T> is an owning array of elements of |T|.
template <typename T>
class Array {

View File

@ -168,7 +168,7 @@ class X25519KeyShare : public SSLKeyShare {
uint8_t private_key_[32];
};
const struct {
CONSTEXPR_ARRAY struct {
int nid;
uint16_t group_id;
const char name[8];