Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(c/driver/postgresql): Start C++17 #1472

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ include(BuildUtils)
project(adbc
VERSION "${ADBC_BASE_VERSION}"
LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(CTest)

Expand Down
9 changes: 5 additions & 4 deletions c/driver/postgresql/copy/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

#pragma once

#include <charconv>
#include <cinttypes>
#include <limits>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -237,10 +239,9 @@ class PostgresCopyNumericFieldWriter : public PostgresCopyFieldWriter {
const int start_pos =
digits_remaining < kDecDigits ? 0 : digits_remaining - kDecDigits;
const size_t len = digits_remaining < 4 ? digits_remaining : kDecDigits;
char substr[kDecDigits + 1];
std::memcpy(substr, decimal_string + start_pos, len);
substr[len] = '\0';
int16_t val = static_cast<int16_t>(std::atoi(substr));
const std::string_view substr{decimal_string + start_pos, len};
int16_t val{};
std::from_chars(substr.data(), substr.data() + substr.size(), val);

if (val == 0) {
if (!seen_decimal && truncating_trailing_zeros) {
Expand Down
1 change: 0 additions & 1 deletion ci/scripts/cpp_clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ build_subproject() {
-DADBC_DRIVER_SNOWFLAKE="${BUILD_DRIVER_SNOWFLAKE}" \
-DADBC_USE_ASAN="${ADBC_USE_ASAN}" \
-DADBC_USE_UBSAN="${ADBC_USE_UBSAN}" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_INSTALL_LIBDIR=lib \
Expand Down
Loading