CACHE STRING "Build architectures for Mac OS X" FORCE)
endif()
+# Set struct packing alignment to word (instead of 1-byte).
+if (BORLAND)
+ add_compile_options(/a4)
+elseif (WATCOM)
+ add_compile_options(/zp4)
+endif()
+
# Output all warnings.
-if (MSVC)
+if (BORLAND)
+ # All warnings except for particular ones.
+ add_compile_options(/w /w-pro /w-aus /w-par /w-ccc /w-inl /w-rch)
+elseif (MSVC)
# All warnings but ignoring "unreferenced formal parameter" and
# "conditional expression is constant" ones.
add_compile_options(/W4 /wd4100 /wd4127)
# Disable crt security warnings, since unfortunately they warn about all
# sorts of safe uses of strncpy.
add_definitions("-D_CRT_SECURE_NO_DEPRECATE")
+elseif (WATCOM)
+ add_compile_options(/wx)
else()
# TODO add -[W]pedantic -Wno-long-long
add_compile_options(-Wall -Wextra)
endif(enable_checksums)
if (enable_werror)
- if (MSVC)
+ if (BORLAND)
+ add_compile_options(/w!)
+ elseif (MSVC)
add_compile_options(/WX)
+ elseif (WATCOM)
+ add_compile_options(/we)
else()
add_compile_options(-Werror)
if (APPLE)
add_definitions("-DGC_PTHREAD_START_STANDALONE")
set(SRC ${SRC} pthread_start.c)
endif(CMAKE_USE_PTHREADS_INIT)
+elseif (BORLAND)
+ # Suppress "GC_push_contents_hdr() is declared but never used" warning.
+ add_compile_options(/w-use)
endif()
if (BUILD_SHARED_LIBS)
add_executable(gctest WIN32 tests/test.c)
target_link_libraries(gctest PRIVATE gc)
add_test(NAME gctest COMMAND gctest)
+ if (WATCOM)
+ # Suppress "conditional expression in if statement is always true/false"
+ # and "unreachable code" warnings in GC_MALLOC_[ATOMIC_]WORDS.
+ target_compile_options(gctest PRIVATE
+ /wcd=13 /wcd=201 /wcd=367 /wcd=368 /wcd=726)
+ endif()
add_executable(hugetest tests/huge_test.c)
target_link_libraries(hugetest PRIVATE gc)
Ivan V. Demakov's README for the Watcom port:
-The collector has been compiled with Watcom C 10.6 and 11.0.
+The collector has been tested with Watcom C 10.6, 11.0 and OpenWatcom 2.0.
It runs under win32, win32s, and even under msdos with dos4gw
dos-extender. It should also run under OS/2, though this isn't
tested. Under win32 the collector can be built either as dll
Incremental collection is supported (except for MSDOS and OS/2).
-cord is not ported.
-
Before compiling you may need to edit WCC_MAKEFILE to set target
platform, library type (dynamic or static), calling conventions, and
optimization options.
including "gc.h" (for example, with -DGC_DLL compiler option). It's
important, otherwise resulting programs will not run.
+The alternate way to compile the collector is to use cmake build system:
+ cmake -G "Watcom WMake" .
+ cmake --build .
+
Special note for OpenWatcom users: the C (unlike the C++) compiler (of the
latest stable release, not sure for older ones) doesn't force pointer global
variables (i.e. not struct fields, not sure for locals) to be aligned unless