Skip to content
Open
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
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ endif()
# its dynamic libs have been installed in ./${LIB} when using the libs
# see for binaries dynamically linked to OpenSSL the output of ${LDD} <binary>
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(USERS "^(\w:)?\\Users\\")
set(USERS "^([a-zA-Z]:)?\\\\Users\\\\")
set(LIB "bin")
else()
set(USERS "^/(home|Users)/")
Expand Down Expand Up @@ -208,13 +208,22 @@ endif()

add_compile_definitions(DEBUG_UNUSED)
add_compile_definitions(PEDANTIC)
add_compile_options(-pedantic) # -Werror is enabled only for development and CI, using Makefile_v1 without NDEBUG
add_compile_options(
-Wall -Woverflow -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wswitch
-Wsign-compare -Wformat -Wtype-limits -Wundef -Wconversion -Wunused-parameter)
add_compile_options(-Wno-c99-extensions -Wno-language-extension-token -Wno-declaration-after-statement -Wno-expansion-to-defined)
if(NOT DEFINED GENCMP_NO_SECUTILS)
add_compile_options(-Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-shadow)

if(MSVC)
# MSVC compiler flags
add_compile_options(/W4) # High warning level
add_compile_options(/wd4996) # Disable deprecated function warnings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be interested to know what happens without this option - which function(s) would be flagged as deprecated?

add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
else()
# GCC/Clang compiler flags
add_compile_options(-pedantic) # -Werror is enabled only for development and CI, using Makefile_v1 without NDEBUG
add_compile_options(
-Wall -Woverflow -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wswitch
-Wsign-compare -Wformat -Wtype-limits -Wundef -Wconversion -Wunused-parameter)
add_compile_options(-Wno-c99-extensions -Wno-language-extension-token -Wno-declaration-after-statement -Wno-expansion-to-defined)
if(NOT DEFINED GENCMP_NO_SECUTILS)
add_compile_options(-Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-shadow)
endif()
Comment on lines +224 to +226
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume that you build using GENCMP_NO_SECUTILS because libSecUtils does not build for Windows, right?
If so, I suggest adding to the the end of the if(MSVC) branch, e.g.:

  if(NOT DEFINED GENCMP_NO_SECUTILS)
    message(FATAL_ERROR "Windows build is not (yet) supported for libSecUtils")
  endif()

endif()
# TODO maybe clean up code and re-enable property
# set_property(TARGET ${LIBGENCMP_NAME} PROPERTY C_STANDARD 90)
Expand Down
25 changes: 21 additions & 4 deletions src/genericCMPClient_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,32 @@ void UTIL_cleanse_free(OPTIONAL char *str)

/* log.c: */

#include <syslog.h>
#ifdef _WIN32
/* Windows doesn't have syslog, so we'll use Windows Event Log or just disable syslog */
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
static void syslog(int priority, const char *format, ...) {
/* Stub implementation for Windows - could be enhanced to use Windows Event Log */
(void)priority;
(void)format;
}
#else
#include <syslog.h>
#endif

static const char *const GENCMP_NAME = "genCMPClient";
static const size_t loc_len = 256;
#define loc_len 256

/*!< these variables are shared between threads */
static LOG_cb_t LOG_fn = 0;
static const char *app_name = GENCMP_NAME;
static severity verbosity = LOG_WARNING;
static const char *app_name = "genCMPClient";
static severity verbosity = 4; /* LOG_WARNING equivalent */
Comment on lines 60 to +66
Copy link
Member

@DDvO DDvO Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you wrote, these changes because the M$ C compiler cannot make full use of constants within macros,
but I believe #define can be used as a workaround - please adapt to:

Suggested change
static const char *const GENCMP_NAME = "genCMPClient";
static const size_t loc_len = 256;
#define loc_len 256
/*!< these variables are shared between threads */
static LOG_cb_t LOG_fn = 0;
static const char *app_name = GENCMP_NAME;
static severity verbosity = LOG_WARNING;
static const char *app_name = "genCMPClient";
static severity verbosity = 4; /* LOG_WARNING equivalent */
#define GENCMP_NAME "genCMPClient"
#define LOC_LEN 256
/*!< these variables are shared between threads */
static LOG_cb_t LOG_fn = 0;
static const char *app_name = GENCMP_NAME;
static severity verbosity = LOG_WARNING;

BIO *bio_err = 0;
BIO *bio_trace = 0;

Expand Down
Loading