summaryrefslogtreecommitdiffstats
path: root/clang/lib/Headers/stddef.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix interaction of max_align_t and modules.Richard Smith2014-10-031-19/+10
| | | | | | | | | When building with modules enabled, we were defining max_align_t as a typedef for a different anonymous struct type each time it was included, resulting in an error if <stddef.h> is not covered by a module map and is included more than once in the same modules-enabled compilation of C11 or C++11 code. llvm-svn: 218931
* Let stddef.h respect __need_{wchar_t, size_t, NULL, ptrdiff_t, wint_t}.Nico Weber2014-04-301-4/+34
| | | | | | | | | | | | | | | | glibc expects that stddef.h only defines a single thing if either of these defines is set. For example, before this change, a C file containing #include <stdlib.h> int ptrdiff_t = 0; would compile with gcc but not with clang. Now it compiles with clang too. This also fixes PR12997, where older versions of the Linux headers would define NULL incorrectly, and glibc would define __need_NULL and expect stddef.h to redefine NULL with the correct definition. llvm-svn: 207606
* Revert r207482; I fail at reading IRC.Nico Weber2014-04-291-16/+0
| | | | llvm-svn: 207483
* Let stddef.h redefine NULL if __need_NULL is set, as needed by glibc, PR12997.Nico Weber2014-04-291-0/+16
| | | | | | | | | See the bug and the cfe-commits thread "[patch] Let stddef.h redefine NULL if __need_NULL is set" for discussion. Fixes PR12997 and is similar to the __need_wint_t bits already in this file. llvm-svn: 207482
* Headers: Provide an ABI compatible max_align_t when _MSC_VER is definedDavid Majnemer2014-03-041-0/+4
| | | | | | | | | | | | | | | | Summary: Our usual definition of max_align_t wouldn't match up with MSVC if it was used in a template argument. Reviewers: chandlerc, rsmith, rnk Reviewed By: chandlerc CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2924 llvm-svn: 202911
* Teach Clang to provide ::max_align_t in C11 and C++11 modes.Chandler Carruth2014-02-191-0/+10
| | | | | | | | | | | | | | | | | | | | | | | This definition is not chosen idly. There is an unfortunate reality with max_align_t -- the specific nature of its definition leaks into the ABI almost immediately. Because it is part of C11 and C++11 it becomes essential for it to match with other systems on that ABI. There is an effort to discourage any further use of this construct as a consequence -- using max_align_t introduces an immediate ABI problem. We can never update it to have larger alignment even as the microarchitecture changes to necessitate higher alignment. =/ The particular definition here exactly matches the ABI of GCC's chosen ::max_align_t definition, for better or worse. This was written with the help of Richard Smith who was decoding the exact ABI implications of the selected definition in GCC. Notably, in-register arguments are impacted by the particular definition chosen. =/ No one is under the illusion that this is a "good" or "useful" definition of max_align_t, and we are working with the standards committee to specify a more useful interface to address this need. llvm-svn: 201729
* Make sure we define wchar_t related macros correctly in -fms-extensions mode.Hans Wennborg2013-05-021-0/+3
| | | | | | | | This adds a test to make sure we define _WCHAR_T_DEFINED and _NATIVE_WCHAR_T_DEFINED correctly in the preprocessor, and updates stddef.h to set it when typedeffing wchar_t. llvm-svn: 180918
* Fix typo in a stddef.h comment: s/risze_t/rsize_t/Hans Wennborg2013-05-021-1/+1
| | | | llvm-svn: 180916
* Headers: Add support for ISO9899:2011 rsize_t.Daniel Dunbar2013-04-121-0/+11
| | | | llvm-svn: 179427
* Revert "[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__."Argyrios Kyrtzidis2013-03-271-3/+1
| | | | | | | | | Per feedback by Doug, we should avoid platform-specific implementations in lib/Headers as much as possible. This reverts commit r178110. llvm-svn: 178181
* [lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__.Argyrios Kyrtzidis2013-03-271-1/+3
| | | | | | This makes it identical with the system definition. llvm-svn: 178110
* <rdar://problem/13479214> Make Clang's <stddef.h> robust against system ↵Douglas Gregor2013-03-221-5/+19
| | | | | | | | | | | | | | headers defining size_t/ptrdiff_t/wchar_t. Clang's <stddef.h> provides definitions for the C standard library types size_t, ptrdiff_t, and wchar_t. However, the system's C standard library headers tend to provide the same typedefs, and the two generally avoid each other using the macros _SIZE_T/_PTRDIFF_T/_WCHAR_T. With modules, however, we need to see *all* of the places where these types are defined, so provide the typedefs (ignoring the macros) when modules are enabled. llvm-svn: 177686
* [Headers] Use standard builtin defines instead of typeof trickery.Daniel Dunbar2013-02-061-2/+2
| | | | | | | - The trickery can confuse more basic source processors, in particular the Unix conformance tool that wants to scan headers. llvm-svn: 174475
* std::nullptr_t support in MS headers, from João Matos.Douglas Gregor2012-06-291-0/+7
| | | | llvm-svn: 159448
* Let NULL and MSVC headers coexist better.Nico Weber2012-04-241-3/+6
| | | | | | Fixes the two issues mentioned in PR12146. llvm-svn: 155490
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* Add '#ifndef _PTRDIFF_T' guard around definition of ptrdiff_t. Fixes ↵Ted Kremenek2011-03-301-0/+3
| | | | | | <rdar://problem/9210154>. llvm-svn: 128578
* lib/Headers/stddef.h: wint_t should be defined whenever <stddef.h> is ↵NAKAMURA Takumi2010-10-191-7/+10
| | | | | | included with __need_wint_t. llvm-svn: 116794
* fix PR7192 by defining wchar_t in a more conventional way. TheChris Lattner2010-09-051-1/+1
| | | | | | type of L"x" can change based on command line arguments. llvm-svn: 113127
* add a hack for visual studio, fixing PR7796Chris Lattner2010-08-031-0/+1
| | | | llvm-svn: 110161
* MinGW requires that wint_t be defined in stddef.h. In order to accomodate, weAlexis Hunt2010-06-151-0/+7
| | | | | | won't define it unless specifically requested via the use of __need_wint_t. llvm-svn: 105985
* Add preprocessor guards to the definitions of size_t and wchar_t, and #undef ↵Ted Kremenek2010-03-081-0/+7
| | | | | | | | NULL before defining it. This addresses potential issues with system headers reported in <rdar://problem/7727159>. llvm-svn: 98006
* Define NULL to __null in C++, so that it's guaranteed to have the same size ↵Douglas Gregor2008-12-011-1/+1
| | | | | | as a pointer llvm-svn: 60355
* #define NULL as 0 when compiling as C++. This fixes the carbon.cpp and ↵Anders Carlsson2008-11-041-0/+5
| | | | | | cocoa.mm test failures. llvm-svn: 58685
* Add a couple more headers. stddef was discussed on cfe-dev, and Eli Friedman2008-05-201-0/+38
consensus was that it was fine; iso646 is trivial. We actually don't need that many headers overall... on Ubuntu, at least, all we need are stdint.h, stdarg.h, limits.h, and float.h to stop depending on having gcc's headers around for normal code. On a side note, the path searching needs some improvement; I had to hardcode the path to my header directory into clang.cpp to get the driver to use it consistently. llvm-svn: 51317
OpenPOWER on IntegriCloud