Skip to content

Commit

Permalink
ARROW-8962: [C++] Add explicit implementation for junk values
Browse files Browse the repository at this point in the history
When linking the tests with `clang-4.0`, I get

```
Undefined symbols for architecture x86_64:
  "arrow::internal::(anonymous namespace)::StringToFloatConverterImpl::main_junk_value_", referenced from:
      arrow::internal::StringToFloat(char const*, unsigned long, float*) in libarrow.a(value_parsing.cc.o)
      arrow::internal::StringToFloat(char const*, unsigned long, double*) in libarrow.a(value_parsing.cc.o)
  "arrow::internal::(anonymous namespace)::StringToFloatConverterImpl::fallback_junk_value_", referenced from:
      arrow::internal::StringToFloat(char const*, unsigned long, float*) in libarrow.a(value_parsing.cc.o)
      arrow::internal::StringToFloat(char const*, unsigned long, double*) in libarrow.a(value_parsing.cc.o)
ld: symbol(s) not found for architecture x86_64
```

These older clang versions need an explicit implementation definition.

Closes apache#7286 from xhochy/ARROW-8962

Authored-by: Uwe L. Korn <uwe.korn@quantco.com>
Signed-off-by: François Saint-Jacques <fsaintjacques@gmail.com>
  • Loading branch information
xhochy authored and bkietz committed May 29, 2020
1 parent e957b87 commit dc54922
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/src/arrow/util/value_parsing.cc
Expand Up @@ -47,6 +47,10 @@ struct StringToFloatConverterImpl {

static const StringToFloatConverterImpl g_string_to_float;

// Older clang versions need an explicit implementation definition.
constexpr double StringToFloatConverterImpl::main_junk_value_;
constexpr double StringToFloatConverterImpl::fallback_junk_value_;

} // namespace

bool StringToFloat(const char* s, size_t length, float* out) {
Expand Down

0 comments on commit dc54922

Please sign in to comment.