[LLVMbugs] [Bug 7796] New: Unconditional gnu extension usage in stddef.h breaks VS2008 headers
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 3 03:20:51 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7796
Summary: Unconditional gnu extension usage in stddef.h breaks
VS2008 headers
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: Headers
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: per at lumai.se
CC: llvmbugs at cs.uiuc.edu
When using clang to compile a trivial C++ program using <iostream> in the
Visual Studio 2008 environment, clang/2.8/include/stddef.h unconditionally
#defines NULL to __null. This causes a problem in the VS2008 header <wchar.h>,
where the function
__inline int __CRTDECL mbsinit(_In_opt_ const mbstate_t *_P)
{return (_P == NULL || *_P == 0); }
expands to
__inline int mbsinit( const mbstate_t *_P)
{return (_P == || *_P == 0); }
Test case:
#include <iostream>
int main(int argc, char **argv)
{
cout << "Hello C++ world" << endl;
return 0;
}
Resulting error:
D:\Temp\llvm>clang++ -fno-exceptions test.cpp -ferror-limit=2
In file included from test.cpp:1:
In file included from c:\Program Files\VStudio 9.0\VC\include/iostream:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/istream:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/ostream:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/ios:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/xlocnum:9:
In file included from c:\Program Files\VStudio 9.0\VC\include/streambuf:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/xiosbase:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/xlocale:8:
In file included from c:\Program Files\VStudio 9.0\VC\include/stdexcept:7:
In file included from c:\Program Files\VStudio 9.0\VC\include/xstring:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/xmemory:9:
In file included from c:\Program Files\VStudio 9.0\VC\include/xutility:7:
In file included from c:\Program Files\VStudio 9.0\VC\include/utility:6:
In file included from c:\Program Files\VStudio 9.0\VC\include/iosfwd:8:
In file included from c:\Program Files\VStudio 9.0\VC\include/cwchar:13:
c:\Program Files\VStudio 9.0\VC\include/wchar.h(1209) : error: expected
expression
{return (_P == NULL || *_P == 0); }
^
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list