Skip to content

Conversation

@reshmadev12
Copy link
Collaborator

Motivation

(Please write out your motivation here.)

Proposed Changes

  1. • CMakeLists.txt changes

BEFORE (causing error)

set(USERS "^(\w:)?\Users\")

AFTER (fixed)

set(USERS "^([a-zA-Z]:)?\\Users\\")

GCC-specific compiler flags like -Woverflow, -pedantic not supported by MSVC. Added following.
if(MSVC)

MSVC compiler flags

add_compile_options(/W4) # High warning level
add_compile_options(/wd4996) # Disable deprecated function warnings
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
else()

GCC/Clang compiler flags

add_compile_options(-pedantic)
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()
endif()
2. • Added stub for syslog for windows: src/genericCMPClient_util.c - #include <syslog.h> not available on Windows
3. Used string literals for const- Problem in using macros as a constant string. For example, following does not work on windows.
static const char *app_name = GENCMP_NAME;
static severity verbosity = LOG_WARNING;

Test Plan

(Please provide clear instructions on how to verify that your changes work.)

@reshmadev12 reshmadev12 requested review from DDvO and rajeev-0 December 5, 2025 10:40
@reshmadev12 reshmadev12 self-assigned this Dec 5, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2025

Copy link
Member

@DDvO DDvO left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.
Here are a couple of questions and suggestions.

Can you please also add a Windows CI build to .github/workflows/ ?

Comment on lines 60 to +66
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 */
Copy link
Member

Choose a reason for hiding this comment

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

Are these changes because the M$ C compiler cannot make full use of constants, where #define can be used as a workaround?
If so, please adapt:

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;

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?

Comment on lines +224 to +226
if(NOT DEFINED GENCMP_NO_SECUTILS)
add_compile_options(-Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-shadow)
endif()
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()

@DDvO
Copy link
Member

DDvO commented Dec 5, 2025

Ah, just realized that @rajeev-0 had already been working on this and earlier today rebased his branch on your work: master...add_windows_CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants