@@ -88,11 +88,27 @@ if(MSVC)
8888 # see https://msdn.microsoft.com/en-us/library/074af4b6.aspx
8989 add_compile_options ("/wd4503" )
9090
91- # suppress C4267 - VC++ complains whenever we implicitly convert an integer to
92- # a smaller type, and most of the time this is just conversion from 64 to 32 bits
93- # for things like vector sizes, which are never that big anyway .
91+ # suppress C4267 - VC++ considers a narrowing conversion from size_t to a smaller
92+ # integer type a warning. this is technically correct but there are so many instances
93+ # of this that we don't want to fix, so... .
9494 add_compile_options ("/wd4267" )
9595
96+ # suppress C4251 - VC++ will warn when exporting an entire class which contains members
97+ # referencing unexported compound types as this is potentially unsafe. because we don't
98+ # guarantee a stable ABI for exports, we don't really care about this, and so we choose to
99+ # be lazy and continue to export entire classes instead of exporting on a method-by-method basis
100+ add_compile_options ("/wd4251" )
101+
102+ # suppress C4068 - VC++ will warn for unknown pragmas by default. this is equivalent to gcc
103+ # -Wno-unknown-pragmas (which is enabled for gcc below).
104+ # we could work around this with sufficiently complex macros
105+ add_compile_options ("/wd4068" )
106+
107+ # suppress C4244 - VC++ warns by default (with /W3) about narrowing conversions that may lose data
108+ # (such as double -> int or int32_t -> int16_t). dfhack has many of these, mostly related to Lua
109+ # this is equivalent to gcc -Wno_conversions which is the default as gcc -Wall doesn't enable -Wconversions
110+ add_compile_options ("/wd4244" )
111+
96112 # MSVC panics if an object file contains more than 65,279 sections. this
97113 # happens quite frequently with code that uses templates, such as vectors.
98114 add_compile_options ("/bigobj" )
@@ -224,7 +240,7 @@ if(UNIX)
224240 # default to hidden symbols
225241 # ensure compatibility with older CPUs
226242 add_definitions (-DLINUX_BUILD )
227- set (GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror -Wl,--disable-new-dtags" )
243+ set (GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror -Wl,--disable-new-dtags -Wno-unknown-pragmas " )
228244 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMMON_FLAGS} " )
229245 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMMON_FLAGS} " )
230246 if (DFHACK_BUILD_64)
0 commit comments