1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Build fixes:

- Fixed build error, which was previously introduced by commit
c8ca89112e

- Treat warnings as errors
This commit is contained in:
Georg Richter
2023-08-16 14:09:34 +02:00
parent c8ca89112e
commit 1acb81e11c
8 changed files with 21 additions and 12 deletions

View File

@@ -99,8 +99,6 @@ IF(MSVC)
INCLUDE(${CC_SOURCE_DIR}/cmake/WindowsCache.cmake)
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN -DNOGDI)
IF (MSVC)
# Treat warnings as errors
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX")
SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO")
FOREACH(BUILD_TYPE ${CONFIG_TYPES})
FOREACH(COMPILER CXX C)
@@ -144,6 +142,13 @@ IF(CMAKE_COMPILER_IS_GNUCC)
ENDFOREACH()
ENDIF()
IF (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU")
SET(WARNING_AS_ERROR "-Werror" CACHE INTERNAL "WARNING_AS_ERROR")
ELSEIF(CMAKE_C_COMPILER_ID MATCHES "MSVC")
SET(WARNING_AS_ERROR "/WX" CACHE INTERNAL "WARNING_AS_ERROR")
ENDIF()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_AS_ERROR}")
# If the build type isn't specified, set to Relwithdebinfo as default.
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")

View File

@@ -5,6 +5,9 @@ project(zlib C)
set(VERSION "1.2.13")
# Don't treat warnings as error for zlib
STRING(REPLACE ${WARNING_AS_ERROR} "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")

View File

@@ -27,6 +27,7 @@
#include <stdlib.h>
#define strcasecmp _stricmp
#define strtok_r strtok_s
#define strdup _strdup
#define sleep(x) Sleep(1000*(x))
#ifdef _MSC_VER
#define inline __inline

View File

@@ -29,6 +29,8 @@
#include <io.h>
#include "shlwapi.h"
#define access _access
static const char *ini_exts[]= {"ini", "cnf", 0};
#define R_OK 4
#else

View File

@@ -962,7 +962,7 @@ static uint8_t mariadb_rpl_send_semisync_ack(MARIADB_RPL* rpl, MARIADB_RPL_EVENT
rpl_set_error(rpl, CR_BINLOG_SEMI_SYNC_ERROR, 0, "semi synchronous replication is not enabled");
return 1;
}
if (!event->is_semi_sync || !event->semi_sync_flags != SEMI_SYNC_ACK_REQ)
if (!event->is_semi_sync || (event->semi_sync_flags != SEMI_SYNC_ACK_REQ))
{
rpl_set_error(rpl, CR_BINLOG_SEMI_SYNC_ERROR, 0, "This event doesn't require to send semi synchronous acknoledgement");
return 1;
@@ -972,7 +972,7 @@ static uint8_t mariadb_rpl_send_semisync_ack(MARIADB_RPL* rpl, MARIADB_RPL_EVENT
buf = alloca(buf_size);
buf[0] = SEMI_SYNC_INDICATOR;
int8store(buf + 1, event->next_event_pos);
int8store(buf + 1, (uint64_t)event->next_event_pos);
memcpy(buf + 9, rpl->filename, rpl->filename_length);
ma_net_clear(&rpl->mysql->net);
@@ -2084,6 +2084,7 @@ int STDCALL mariadb_rpl_get_optionsv(MARIADB_RPL *rpl,
{
unsigned int* semi_sync = va_arg(ap, unsigned int*);
*semi_sync = rpl->is_semi_sync;
break;
}
default:

View File

@@ -121,11 +121,7 @@ extern int _getopt_internal (int argc, char *const *argv,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
extern int getopt (int argc, char *const *argv, const char *optstring);
#endif /* __STDC__ */
#ifdef __cplusplus

View File

@@ -38,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <pthread.h>
#else
#include <io.h>
#define unlink _unlink
#endif
#ifndef OK

View File

@@ -342,9 +342,9 @@ static int test_conc592(MYSQL *my __attribute__((unused)))
}
struct my_tests_st my_tests[] = {
// {"test_conc592", test_conc592, TEST_CONNECTION_NEW, 0, NULL, NULL},
//{"test_rpl_async", test_rpl_async, TEST_CONNECTION_NEW, 0, NULL, NULL},
//{"test_rpl_semisync", test_rpl_semisync, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_conc592", test_conc592, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_rpl_async", test_rpl_async, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_rpl_semisync", test_rpl_semisync, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_conc467", test_conc467, TEST_CONNECTION_NEW, 0, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};