abseil / abseil/abseil-cpp

Does not compile on windows (MSVC)

Aberta
#1,337 4 comentários 0 reações 0 responsáveis Ver no GitHub
bug
Linguagem predominante
C++
Estrelas
18.1k
Forks
3.2k
Merge médio
20h 36min
PRs com merge (30d)
1

Descrição

As known, (see https://github.com/abseil/abseil-cpp/blob/master/absl/base/internal/atomic_hook.h#L139, https://github.com/abseil/abseil-cpp/issues/659, etc.), MSVC does not provide a constinit std::atomic.

But, both https://github.com/abseil/abseil-cpp/blob/master/absl/strings/internal/cordz_handle.cc#L27 and https://github.com/abseil/abseil-cpp/blob/master/absl/strings/internal/cordz_info.cc#L41 attempt to define a ABSL_CONST_INIT object which contain a std::atomic (https://github.com/abseil/abseil-cpp/blob/master/absl/strings/internal/cordz_handle.h#L90, https://github.com/abseil/abseil-cpp/blob/master/absl/strings/internal/cordz_info.h#L196).

This makes absl not compilable with the latest MSVC.

I see a macro ABSL_INTERNAL_CORDZ_ENABLED https://github.com/abseil/abseil-cpp/blob/72ec15a317a74cccf03a62f749f3ab28206be069/absl/strings/internal/cordz_functions.h#L47, which is false for MSVC; does this mean cordz_info and cordz_handle are not even needed, as a simple 'fix'? Or do we need a different workaround?

```
absl\strings\internal\cordz_info.cc:41:44: error: variable does not have a constant initializer
ABSL_CONST_INIT CordzInfo::List CordzInfo::global_list_{absl::kConstInit};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
absl\strings\internal\cordz_info.cc:41:1: note: required by 'require_constant_initialization' attribute here
ABSL_CONST_INIT CordzInfo::List CordzInfo::global_list_{absl::kConstInit};
^~~~~~~~~~~~~~~
absl/base/attributes.h:714:27: note: expanded from macro 'ABSL_CONST_INIT'
#define ABSL_CONST_INIT [[clang::require_constant_initialization]]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...xxatomic:207:21: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
: _Atomic_address{(_ATOMIC_UINT)_Right}
^
abseil-cpp\absl/strings/internal/cordz_info.h:196:56: note: in call to 'atomic(nullptr)'
std::atomic head ABSL_GUARDED_BY(mutex){nullptr};
```

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.