Correctly detect _set_invalid_parameter_handler

There is still at least one Microsoft-supported version of the CRT which
does not include the secure versions of various functions, and
consequently does not include `_set_invalid_parameter_handler`.

Tests for the definition and inclusion of
caml_install_invalid_parameter_handler refined to detect
`__STDC_SECURE_LIB__` defined in `crtdefs.h`. This is a badly documented,
but standardised, define. Although `__STDC_SECURE_LIB__` is compatible
with MinGW, I have retained the test for `_MSC_VER` and so kept this as an
MSVC-only patch.
master
David Allsopp 2015-12-30 20:24:10 +00:00 committed by alainfrisch
parent de857d6fb9
commit ef2cdbe1e7
3 changed files with 6 additions and 6 deletions

View File

@ -88,7 +88,7 @@ extern value caml_start_program (void);
extern void caml_init_ieee_floats (void);
extern void caml_init_signals (void);
#ifdef _MSC_VER
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L
/* PR 4887: avoid crash box of windows runtime on some system calls */
extern void caml_install_invalid_parameter_handler();
@ -105,7 +105,7 @@ void caml_main(char **argv)
caml_init_frame_descriptors();
caml_init_ieee_floats();
#ifdef _MSC_VER
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L
caml_install_invalid_parameter_handler();
#endif
caml_init_custom_operations();

View File

@ -259,7 +259,7 @@ extern void caml_init_ieee_floats (void);
extern void caml_signal_thread(void * lpParam);
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L
/* PR 4887: avoid crash box of windows runtime on some system calls */
extern void caml_install_invalid_parameter_handler();
@ -281,7 +281,7 @@ CAMLexport void caml_main(char **argv)
/* Machine-dependent initialization of the floating-point hardware
so that it behaves as much as possible as specified in IEEE */
caml_init_ieee_floats();
#ifdef _MSC_VER
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L
caml_install_invalid_parameter_handler();
#endif
caml_init_custom_operations();
@ -397,7 +397,7 @@ CAMLexport void caml_startup_code(
static char proc_self_exe[256];
caml_init_ieee_floats();
#ifdef _MSC_VER
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L
caml_install_invalid_parameter_handler();
#endif
caml_init_custom_operations();

View File

@ -579,7 +579,7 @@ int caml_win32_random_seed (intnat data[16])
}
#ifdef _MSC_VER
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L
static void invalid_parameter_handler(const wchar_t* expression,
const wchar_t* function,