[cfe-dev] Declaration of MSVC internal functions

Benoit Perrot benoit at lrde.epita.fr
Wed Jan 19 03:18:57 PST 2011


While experimenting with Clang and MSVC 9 (and among the different
issues), including "iosfwd" generates the following error:

C:\Program Files\Microsoft Visual Studio 9.0\VC\include/iosfwd(219) :
error: no member named '_invalid_parameter_noinfo' in the global namespace;
did you mean '_invalid_parameter_handler'?

                 _SCL_SECURE_CRT_VALIDATE(_Dest_size >= _Count, NULL);

In file included from C:/tmp/test-iosfwd.cpp:1:
In file included from C:\Program Files\Microsoft Visual Studio  
In file included from C:\Program Files\Microsoft Visual Studio  
C:\Program Files\Microsoft Visual Studio 9.0\VC\include/yvals.h:226:4: note:
instantiated from:

                         _SCL_SECURE_INVALID_PARAMETER(cond);            \
C:\Program Files\Microsoft Visual Studio 9.0\VC\include/yvals.h:183:47: note:
instantiated from:

#define _SCL_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter_noinfo()

(To the curious one: this is related to safety checks that where added
to common C runtime functions. MSDN says that defining the macro
"_CRT_SECURE_NO_DEPRECATE" silences the warnings related to the usage
of these "unsafe" functions -- but it does not fix the build with

"iosfwd" uses "_SCL_SECURE_CRT_VALIDATE" which uses
"_SCL_SECURE_INVALID_PARAMETER" which is defined as a call to
"::_invalid_parameter_noinfo". Yet "::_invalid_parameter_noinfo" is
declared nowhere in the translation unit; its declaration can be found
in "Microsoft Visual Studio 9.0/VC/crt/src/internal.h". Including this
file is not required by MSVC for compiling users of "iosfwd".

So, here is the question: shall this function (and the
others that can be found in "internal.h") be considered as a builtin?

Adding it to "Basic/Builtins.def" as follows:

        // Random Microsoft VC9 runtime builtins.
        BUILTIN(_invalid_parameter_noinfo, "v.", "n")

silences the error; but should'nt it be activated only when simulating

Would'nt it be a better idea to silently include "crt/src/internal.h"
when some appropriated cocktail of driver options are activated?


This message was sent using IMP, the Internet Messaging Program.

More information about the cfe-dev mailing list