Boost logo

Boost :

Subject: Re: [boost] [test] Still having issues
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-10-13 11:41:43


>>>>> I'm still having a lot of issues with the latest Boost.Test not
>>>>> building:
>>>>>
>>>>> On Win32 with Intel's 11.1 and 12.1 compilers I see:
>>>>>
>>>>> ..\..\..\boost/test/impl/execution_monitor.ipp(104): error: invalid
>>>>> redeclaration of type name "_invalid_parameter_handler" (declared at
>>>>> line
>>>>> 228 of "C:\Program Files\Microsoft Visual Studio
>>>>> 10.0\VC\INCLUDE\stdlib.h")
>>>>> typedef void* _invalid_parameter_handler;
>>>>
>>>> This was not changed. Is this new compiler?
>>>
>>> 12.1 is, but the same issue occurs on 11.1 which has been around for
>>> ages.
>>
>> Well, in might have never worked or something changed outside of
>> Boost.Test
>> cause this line was there since 2007 and nothing relevant change in a
>> vicinity
>> since.
>>
>> Gennadiy
>>
>> P.S. If you (or someone else) know what needs to be done to fix this I am
>> open
>> to patches

Here's the problem:

In VC10, the declaration in stdlib.h is:

typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *, const
wchar_t *, const wchar_t *, unsigned int, uintptr_t);

But then you redeclare as:

typedef void* _invalid_parameter_handler;

Now if the compiler is *really* VC10, then your workaround code isn't
activated and everything is OK, but when the compiler is Intel sitting on
top of MSVC, BOOST_MSVC is rightly not defined, so:

# if (!BOOST_WORKAROUND(BOOST_MSVC, >= 1400 ) && \
      !defined(BOOST_COMO)) || defined(UNDER_CE)

Evaluates to true, and the problematic workaround occurs.

Furthermore, I've just checked the headers on my HD and VC8, 9 and 10 all do
define that symbol in stdlib.h in exactly the same way:

#if !defined(_M_CEE_PURE)
/* a invalid_arg handler procedure. */
typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *, const
wchar_t *, const wchar_t *, unsigned int, uintptr_t);

/* establishes a invalid_arg handler for the process */
_CRTIMP _invalid_parameter_handler __cdecl
_set_invalid_parameter_handler(_In_opt_ _invalid_parameter_handler
_Handler);
_CRTIMP _invalid_parameter_handler __cdecl
_get_invalid_parameter_handler(void);
#endif

So I suggest that:

* You change the definition of _invalid_parameter_handler to the correct
one, and,
* Use _MSC_VER in place of BOOST_MSVC in the pp-test:

# if (!BOOST_WORKAROUND(_MSC_VER, >= 1400 ) && \
      !defined(BOOST_COMO)) || defined(UNDER_CE)

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk