Skip to content
This repository was archived by the owner on May 2, 2026. It is now read-only.

Commit 70e7a2f

Browse files
andy5995claude
andcommitted
meson.build: Skip GCC/Clang-only flags on MSVC
get_supported_arguments() doesn't reliably filter flags on MSVC (e.g. -fstack-protector-strong passes the probe but emits D9002 at compile time). Guard the extra_flags block with a compiler id check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b871a24 commit 70e7a2f

2 files changed

Lines changed: 24 additions & 22 deletions

File tree

‎meson.build‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ project(
88

99
cc = meson.get_compiler('c')
1010

11-
extra_flags = [
12-
'-fno-common',
13-
'-fstack-protector-strong',
14-
'-Wformat-security',
15-
'-Wshadow',
16-
'-Wstrict-overflow=5',
17-
'-Werror=odr',
18-
'-Werror=strict-aliasing',
19-
]
20-
21-
add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c')
11+
if cc.get_id() != 'msvc'
12+
extra_flags = [
13+
'-fno-common',
14+
'-fstack-protector-strong',
15+
'-Wformat-security',
16+
'-Wshadow',
17+
'-Wstrict-overflow=5',
18+
'-Werror=odr',
19+
'-Werror=strict-aliasing',
20+
]
21+
add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c')
22+
endif
2223

2324
# Parse version components
2425
version_components = meson.project_version().split('.')

‎subprojects/pcg/meson.build‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ project(
88

99
cc = meson.get_compiler('c')
1010

11-
extra_flags = [
12-
'-fno-common',
13-
'-fstack-protector-strong',
14-
'-Wformat-security',
15-
'-Wshadow',
16-
'-Wstrict-overflow=5',
17-
'-Werror=odr',
18-
'-Werror=strict-aliasing',
19-
]
20-
21-
add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c')
11+
if cc.get_id() != 'msvc'
12+
extra_flags = [
13+
'-fno-common',
14+
'-fstack-protector-strong',
15+
'-Wformat-security',
16+
'-Wshadow',
17+
'-Wstrict-overflow=5',
18+
'-Werror=odr',
19+
'-Werror=strict-aliasing',
20+
]
21+
add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c')
22+
endif
2223

2324
_pcg = static_library('pcg', 'pcg_basic.c')
2425

0 commit comments

Comments
 (0)