Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correcting and simplifying check for either Visual Studio or Windows #534

Closed
wants to merge 4 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/ctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ jobs:
working-directory: ${{github.workspace}}/build
run: ls && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DADD_G3LOG_UNIT_TEST=ON ..

- name: Build Linux/OSx
- name: CMake build step
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE

- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -C $BUILD_TYP
run: ctest --verbose -C $BUILD_TYP

- name: Fatal Exit Example Linux/OSX
working-directory: ${{github.workspace}}/build
Expand Down
7 changes: 4 additions & 3 deletions src/logcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// For Windows we need force a thread_local install per thread of three
// signals that must have a signal handler installed per thread-basis
// It is really a royal pain. Seriously Microsoft? Seriously?
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
#if defined(_WIN32)
#define SIGNAL_HANDLER_VERIFY() g3::installSignalHandlerForThread()
#else
// Does nothing --- enforces that semicolon must be written
Expand Down Expand Up @@ -85,7 +85,8 @@ void LogCapture::capturef(const char* printf_like_message, ...) {
#else
static const int kMaxMessageSize = 2048;
char finished_message[kMaxMessageSize];
#if ((defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(__GNUC__))
// special handling for visual studio
#if defined(_MSC_VER)
auto finished_message_len = _countof(finished_message);
#else
int finished_message_len = sizeof(finished_message);
Expand All @@ -95,7 +96,7 @@ void LogCapture::capturef(const char* printf_like_message, ...) {
va_list arglist;
va_start(arglist, printf_like_message);

#if ((defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(__GNUC__))
#if defined(_MSC_VER)
const int nbrcharacters = vsnprintf_s(finished_message, finished_message_len, _TRUNCATE, printf_like_message, arglist);
#else
const int nbrcharacters = vsnprintf(finished_message, finished_message_len, printf_like_message, arglist);
Expand Down
Loading