Skip to content

Commit

Permalink
fix: gcc 12 compile
Browse files Browse the repository at this point in the history
  • Loading branch information
sangshuduo committed Mar 11, 2023
1 parent 38ceff4 commit 51d9a75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/3.0-windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
with:
repository: 'taosdata/TDengine'
path: 'TDengine'
ref: 'fix/sangshuduo/TD-23094-taosbenchmark-sub-2.6'
ref: 'fix/sangshuduo/TD-19593-gcc12-support'

- name: create debug directory
if: |
Expand Down
16 changes: 10 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,18 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
)
MESSAGE(STATUS "src's cmake detected current OS is " ${OS_ID} "")

EXECUTE_PROCESS (
IF (${OS_ID} MATCHES "arch")
MESSAGE(STATUS "${OS_ID} linux has no libatomic.a, use dynamic lib instead of")
ELSE ()
EXECUTE_PROCESS (
COMMAND gcc -print-file-name=libatomic.a
OUTPUT_VARIABLE LIBATOMIC_PATH
)
STRING(STRIP "${LIBATOMIC_PATH}" LIBATOMIC_PATH)
MESSAGE(STATUS "libatomic.a path: ${LIBATOMIC_PATH}")
ADD_LIBRARY(atomic STATIC IMPORTED)
SET_PROPERTY(TARGET atomic PROPERTY IMPORTED_LOCATION "${LIBATOMIC_PATH}")
)
STRING(STRIP "${LIBATOMIC_PATH}" LIBATOMIC_PATH)
MESSAGE(STATUS "libatomic.a path: ${LIBATOMIC_PATH}")
ADD_LIBRARY(atomic STATIC IMPORTED)
SET_PROPERTY(TARGET atomic PROPERTY IMPORTED_LOCATION "${LIBATOMIC_PATH}")
ENDIF ()

ADD_LIBRARY(avro STATIC IMPORTED)
SET_PROPERTY(TARGET avro PROPERTY IMPORTED_LOCATION
Expand Down
6 changes: 4 additions & 2 deletions src/benchQuery.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,12 @@ void *queryKiller(void *arg) {
if (execUSec > g_queryInfo.killQueryThreshold * 1000000) {
char sql[SHORT_1K_SQL_BUFF_LEN] = {0};
tstrncpy(sql, (char*)row[2],
min(strlen((char*)row[2]), SHORT_1K_SQL_BUFF_LEN));
min(strlen((char*)row[2])+1,
SHORT_1K_SQL_BUFF_LEN));

char killId[KILLID_LEN] = {0};
tstrncpy(killId, (char*)row[0], KILLID_LEN);
tstrncpy(killId, (char*)row[0],
min(strlen((char*)row[0])+1, KILLID_LEN));
char killCommand[KILLID_LEN + 15] = {0};
snprintf(killCommand, KILLID_LEN + 15,
"KILL QUERY '%s'", killId);
Expand Down

0 comments on commit 51d9a75

Please sign in to comment.