Skip to content

Commit

Permalink
cleanup(userspace): move NOMINMAX definition at compile time for wind…
Browse files Browse the repository at this point in the history
…ows buils.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Dec 16, 2024
1 parent 07a16e9 commit 3126a97
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cmake/modules/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ else() # MSVC
set(CMAKE_CXX_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")

# "_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" enables a workaround for windows GH runner issue, see
# https://github.com/actions/runner-images/issues/10004
# https://github.com/actions/runner-images/issues/10004 Also, define NOMINMAX globally.
add_compile_definitions(
_HAS_STD_BYTE=0 WIN32_LEAN_AND_MEAN _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
_HAS_STD_BYTE=0 WIN32_LEAN_AND_MEAN _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR NOMINMAX
)
endif()
4 changes: 0 additions & 4 deletions userspace/libscap/scap_print_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ limitations under the License.
#include <libscap/scap.h>
#include <libscap/scap-int.h>
#if defined(_WIN32)
/* This prevents including <windows.h> when including Ws2tcpip.h */
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Ws2tcpip.h>
#else
#include <arpa/inet.h>
Expand Down
1 change: 0 additions & 1 deletion userspace/libsinsp/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ limitations under the License.
#include <algorithm>
#include <unistd.h>
#else
#define NOMINMAX
#define localtime_r(a, b) (localtime_s(b, a) == 0 ? b : NULL)
#endif

Expand Down
1 change: 0 additions & 1 deletion userspace/libsinsp/filter_compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ limitations under the License.
#include <libsinsp/memmem.h>

#ifdef _WIN32
#define NOMINMAX
#pragma comment(lib, "Ws2_32.lib")
#include <WinSock2.h>
#include <WS2tcpip.h>
Expand Down
1 change: 0 additions & 1 deletion userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
*/

#ifdef _WIN32
#define NOMINMAX
#include <winsock2.h>
#else
#include <sys/socket.h>
Expand Down
4 changes: 0 additions & 4 deletions userspace/libsinsp/sinsp_inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ limitations under the License.
#pragma once

#if defined(_WIN32)
/* This prevents including <windows.h> when including Ws2tcpip.h */
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Ws2tcpip.h>
#else
#include <arpa/inet.h>
Expand Down

0 comments on commit 3126a97

Please sign in to comment.