Skip to content
Merged
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
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,25 @@ jobs:
ninja
cd -

Windows-clang-build:

runs-on: windows-latest

permissions: read-all
steps:
- uses: actions/checkout@v4
- name: Install Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
- uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # master
- name: Build libs
run: |
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
# disasmtool can not be built with clang on Windows at the moment.
ninja bddisasm bdshemu
cd -

Macos-build:

runs-on: macos-latest
Expand Down
53 changes: 32 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,54 @@ endif ()

# These are shared by bddisasm and bdshemu.
if (MSVC OR "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX)
if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX)
endif ()
else ()
set(BDDISASM_COMMON_COMPILE_OPTIONS
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
-Wall
-Wno-unknown-pragmas
-Wextra
-Wshadow
-Wformat-security
-Wstrict-overflow=2
-Wstrict-prototypes
-Wwrite-strings
-Wshadow
-Winit-self
-Wno-unused-function
-Wno-multichar
-Wno-incompatible-pointer-types
-Wnull-dereference
-Werror=format-security
-Werror=implicit-function-declaration
-pipe
-fwrapv
-fno-strict-aliasing
-fstack-protector-strong
-fno-omit-frame-pointer
-ffunction-sections
-fdata-sections
-g3
-gdwarf-4
-grecord-gcc-switches
-march=native)
)

if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
list(APPEND BDDISASM_COMMON_COMPILE_OPTIONS
-Wall
-Wextra
-Wshadow
-Wformat-security
-Wstrict-overflow=2
-Wstrict-prototypes
-Wwrite-strings
-Winit-self
-Werror=format-security
-Werror=implicit-function-declaration
-fno-omit-frame-pointer
-g3
-gdwarf-4
-grecord-gcc-switches
-march=native
)
endif ()

if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND BDDISASM_COMMON_COMPILE_OPTIONS
-Wduplicated-cond
-Wno-discarded-qualifiers)
-Wno-discarded-qualifiers
)

if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
list(APPEND BDDISASM_COMMON_COMPILE_OPTIONS
-Wduplicated-cond
)
endif ()
endif ()
endif ()

Expand Down
8 changes: 8 additions & 0 deletions inc/bddisasm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#ifndef BDDISASM_TYPES_H
#define BDDISASM_TYPES_H

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
#endif

#if defined(_MSC_VER) || defined(__ICC) || defined(__INTEL_COMPILER)

Expand Down Expand Up @@ -104,4 +108,8 @@ typedef ND_UINT8 ND_BOOL;
#define ND_TRUE (1)
#define ND_FALSE (0)

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

#endif // BDDISASM_TYPES_H
9 changes: 9 additions & 0 deletions inc/bdx86_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
#include "bdx86_constants.h"
#include "bdx86_cpuidflags.h"

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
#pragma clang diagnostic ignored "-Wnested-anon-types"
#endif

#ifdef _MSC_VER
#pragma warning(push)
Expand Down Expand Up @@ -1955,4 +1960,8 @@ NdInitContext(
#pragma warning(pop)
#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

#endif // BDX86_CORE_H
Loading