New macro (CONSOLE_LOG) to enable logging to console on Win32
authorIvan Maidanski <ivmai@mail.ru>
Thu, 12 Sep 2019 07:08:06 +0000 (10:08 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 12 Sep 2019 08:08:56 +0000 (11:08 +0300)
commitc2b191639b73d761d94f5deea8b8a65d44fd57f0
tree81e9d724633024c244a4747442fa2486a428bd3e
parentd73c341351fff11b638a5d27168a24922077ce7f
New macro (CONSOLE_LOG) to enable logging to console on Win32

The macro is effective only on the Win32 (MSWIN32) target.  It changes
the logging facility to be the same as on Cygwin and other Unix-like
targets.

* doc/README.macros (CONSOLE_LOG): Document new macro.
* include/private/gc_priv.h [THREADS && MSWIN32 && CONSOLE_LOG]
(GC_write_cs): Do not declare.
* include/private/gc_priv.h [THREADS && MSWIN32 && CONSOLE_LOG
&& GC_ASSERTIONS] (GC_write_disabled): Likewise.
* misc.c [CONSOLE_LOG && MSWIN32]: Include fcntl.h, sys/types.h,
sys/stat.h.
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_write_cs):
Do not define.
* win32_threads.c [GC_ASSERTIONS && MSWIN32 && CONSOLE_LOG]
(GC_write_disabled): Likewise.
* misc.c [MSWIN32 && CONSOLE_LOG] (GC_stdout, GC_stderr, GC_log): Define
STATIC variable (of int type).
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_init): Do not
call InitializeCriticalSection(&GC_write_cs); handle GC_LOG_FILE and
GC_ONLY_LOG_TO_FILE environment variables.
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_deinit): Do
not call DeleteCriticalSection(&GC_write_cs).
* misc.c [MSWIN32 && CONSOLE_LOG] (IF_NEED_TO_LOCK, getWinRTLogPath,
GC_CreateLogFile): Do not define.
* misc.c [!PCR && !SMALL_CONFIG && !GC_ANDROID_LOG && GC_WIN32_THREADS
&& GC_ASSERTIONS MSWIN32 && CONSOLE_LOG] (GC_default_on_abort): Do not
use GC_write_disabled.
* win32_threads.c [MSWIN32 && CONSOLE_LOG] (GC_stop_world): Do not use
GC_write_disabled and GC_write_cs.
doc/README.macros
include/private/gc_priv.h
misc.c
win32_threads.c