Skip to content

Commit

Permalink
build(c): set -Og -ggdb and warn about Conda setting -O2
Browse files Browse the repository at this point in the history
Fixes #1608.
  • Loading branch information
lidavidm committed Mar 12, 2024
1 parent 27d62c3 commit 4c2e832
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion c/cmake_modules/AdbcDefines.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
endif()

# Set common build options
string(TOLOWER "${CMAKE_BUILD_TYPE}" _lower_build_type)
if("${ADBC_BUILD_WARNING_LEVEL}" STREQUAL "")
string(TOLOWER "${CMAKE_BUILD_TYPE}" _lower_build_type)
if("${_lower_build_type}" STREQUAL "release")
set(ADBC_BUILD_WARNING_LEVEL "PRODUCTION")
else()
Expand Down Expand Up @@ -92,6 +92,26 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
-Werror
-Wno-unused-parameter)
set(ADBC_C_CXX_FLAGS_PRODUCTION -Wall)

if(NOT CMAKE_C_FLAGS_DEBUG MATCHES "-O")
string(APPEND CMAKE_C_FLAGS_DEBUG " -Og")
endif()
if(NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "-O")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og")
endif()

if(NOT CMAKE_C_FLAGS_DEBUG MATCHES "-g")
string(APPEND CMAKE_C_FLAGS_DEBUG " -g3")
endif()
if(NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "-g")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g3")
endif()
if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-g")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -g3")
endif()
if(NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-g")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -g3")
endif()
else()
message(WARNING "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
Expand Down
2 changes: 1 addition & 1 deletion c/driver/sqlite/sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ AdbcStatusCode SqliteStatementGetParameterSchema(struct AdbcStatement* statement
ArrowSchemaInit(schema);
CHECK_NA(INTERNAL, ArrowSchemaSetType(schema, NANOARROW_TYPE_STRUCT), error);
CHECK_NA(INTERNAL, ArrowSchemaAllocateChildren(schema, num_params), error);
char buffer[11];
char buffer[12];
for (int i = 0; i < num_params; i++) {
const char* name = sqlite3_bind_parameter_name(stmt->stmt, i + 1);
if (name == NULL) {
Expand Down

0 comments on commit 4c2e832

Please sign in to comment.