Commit Graph

40 Commits

Author SHA1 Message Date
Eli Friedman fe0739dffb Some small improvements to the builtin (-ffreestanding) stdint.h; in
particular, make sure to handle WCHAR_MIN correctly.

llvm-svn: 130618
2011-04-30 19:02:59 +00:00
Eli Friedman 4547752402 PR9772: Fix the definition of WINT_MIN and WINT_MAX on Linux -ffreestanding.
llvm-svn: 129907
2011-04-21 05:45:45 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Daniel Dunbar 540e8b1dcd Headers: Change [u]intmax_t to be defined in terms of __[U]INTMAX_TYPE__, instead of intN_t.
llvm-svn: 107254
2010-06-30 06:30:50 +00:00
Daniel Dunbar cfc12ddb0a Headers: Hide intptr_t and uintptr_t definitions behind _INTPTR_T and _UINTPTR_T
defines, for increased compatibility with Darwin gcc.
 - This is a bit of a hack, since platform compatibility issues don't belong
   here, but I don't think this hurts anyone either.

llvm-svn: 102264
2010-04-24 20:32:12 +00:00
Ken Dyck f540ae5ab3 Define SIG_ATOMIC_MIN and SIG_ATOMIC_MAX in terms of __SIG_ATOMIC_WIDTH__.
llvm-svn: 89598
2009-11-22 15:47:12 +00:00
Ken Dyck 33211d9658 Avoid unwanted expansion in macros that paste together INT<n>_C(v) and
UINT<n>_C(v) macros. 

llvm-svn: 89461
2009-11-20 16:49:10 +00:00
Ken Dyck 8dcc21420b Avoid unwanted expansion in macros that paste together INT<n>_MIN, INT<n>_MAX,
and UINT<n>_MAX defintions.

llvm-svn: 89460
2009-11-20 16:44:38 +00:00
Ken Dyck 764a5f3881 Avoid unwanted macro expansion in macros that paste together int<n>_t and
uint<n>_t definitions.

llvm-svn: 89459
2009-11-20 16:37:35 +00:00
Ken Dyck aff01ceb95 Define WCHAR_MIN and WCHAR_MAX in terms of __WCHAR_WIDTH__ for consistency with
other limit macros.

llvm-svn: 89355
2009-11-19 15:53:08 +00:00
Ken Dyck f0b343f5b7 Parameterize WINT_MIN and WINT_MAX with __WINT_WIDTH__ to support arbitrary
widths. This corrects the values of these definitions for MSP430 and PIC16.

llvm-svn: 89350
2009-11-19 14:35:19 +00:00
Ken Dyck 279ed5189c Construct definition of SIZE_MAX from __SIZE_WIDTH__ to support targets of
arbitrary widths.

llvm-svn: 89347
2009-11-19 14:03:24 +00:00
Ken Dyck 8af6035ac9 Construct the macro body of PTRDIFF_MAX and PTRDIFF_MIN from __PTRDIFF_WIDTH__.
llvm-svn: 89343
2009-11-19 12:33:01 +00:00
Ken Dyck 68fa5afada Construct INTPTR_MIN, INTPTR_MAX, and UINTPTR_MAX from the exact-width limit
macros corresponding to __INTPTR_WIDTH__.

llvm-svn: 89239
2009-11-18 20:36:29 +00:00
Ken Dyck 2d4371d666 Define intptr_t and uintptr_t in terms of their equivalent exact-width types.
llvm-svn: 89237
2009-11-18 20:24:13 +00:00
Ken Dyck ac11b7b625 Define INTMAX_C and UINTMAX_C in terms of the corresponding exact-width
INTn_C and UINTn_C macros.

llvm-svn: 89226
2009-11-18 19:42:57 +00:00
Ken Dyck 63c8ef8256 Define INTMAX_MIN, INTMAX_MAX, and UINTMAX_MAX in terms of the limit macros for
their corresponding exact-width type. 

llvm-svn: 89224
2009-11-18 19:22:15 +00:00
Ken Dyck 47181584f1 Define intmax_t and uintmax_t as the [u]intN_t type corresponding to
__INTMAX_WIDTH__.

llvm-svn: 89221
2009-11-18 18:57:04 +00:00
Ken Dyck 19ac306c2c Replace (-INT8_C(128)), which uses an illegally out-of-range argument for
INT8_C, with (-INT8_C(127)-1) in the definition of INT8_MIN. Apply similar
changes to the definitions of INT16_MIN and INT24_MIN.

llvm-svn: 89120
2009-11-17 18:29:12 +00:00
Ken Dyck f78dc738a5 Use the INTn_C integer constant macros to generate limit constants with correct
suffixes. This corrects the suffixes for the limit constants of the 32-bit
types on MSP430 and PIC16, and the 64-bit types on PPC64, SystemZ, X86_64.

llvm-svn: 89101
2009-11-17 16:26:27 +00:00
Ken Dyck e115235705 Remove unnecessary parens around the bodies of integer constant macros. C99
requires that their arguments be decimal, hex, octal constants---no signs
allowed---making the parens unnecessary.

llvm-svn: 89095
2009-11-17 13:54:02 +00:00
Ken Dyck 2dc8d5fa3e Parameterize the constant-generating macros in stdint.h with new built-in
__INTn_C_SUFFIX__ macros that are defined for types with corresponding
constant suffixes (i.e. long and long long).

llvm-svn: 88914
2009-11-16 16:36:33 +00:00
Chris Lattner 55c9877b66 Generalize stdint.h for non-8-bit-multiple types, patch by
Ken Dyck!

"This adds definitions for types of 8-bit multiples
from 8 to 64 to stdint.h and rationalizes the selection of types 
for the exact-width definitions in InitPreprocessor.cpp."

llvm-svn: 86977
2009-11-12 08:08:27 +00:00
Chris Lattner b0966de585 A simple reordering of the definitions in stdint.h and
introduces no new function changes.   Patch by Ken Dyck!

llvm-svn: 86062
2009-11-04 23:03:18 +00:00
John Thompson ac0b098d4d Added __has_include and __has_include_next.
llvm-svn: 85834
2009-11-02 22:28:12 +00:00
Eli Friedman 7df3447c10 Fix for PR3841: follow gcc's example and fall back to the system
stdint.h unless we are freestanding.

Any suggestions here are welcome.

llvm-svn: 70806
2009-05-03 23:00:48 +00:00
Chris Lattner 61639745b6 glibc plays some weird games with multiple different definitions of
int8_t and games it with strange *_defined macros.  Emulate its weirdness
for better compatibility with linux etc.  Problem pointed out by anders 
johnson.

llvm-svn: 69458
2009-04-18 19:11:11 +00:00
Daniel Dunbar 2e8536cfaa Only intptr_t is protected by __intptr_t_defined.
llvm-svn: 67018
2009-03-15 03:16:47 +00:00
Chris Lattner 5a5194fec3 fix inverted conditional, rdar://6633188
llvm-svn: 65704
2009-02-28 18:53:33 +00:00
Chris Lattner 39bb0182bd anders johnson points out that some software depends on the
definition of __intptr_t_defined when stdint.h defines intptr_t.

llvm-svn: 64497
2009-02-13 22:43:13 +00:00
Chris Lattner 7e4c81c8c6 Give TargetInfo a new IntPtrType to hold the intptr_t type for
a target.

Make Preprocessor.cpp define a new __INTPTR_TYPE__ macro based on this.

On linux/32, set intptr_t to int, instead of long.  This fixes PR3563.

llvm-svn: 64495
2009-02-13 22:28:55 +00:00
Anders Carlsson 7325b61e74 Fix an #ifndef that should be an #ifdef instead.
llvm-svn: 64206
2009-02-10 06:18:19 +00:00
Chris Lattner 4293c8935a C++ really shouldn't check these #defines, thanks to Howard
for pointing this out!

llvm-svn: 64037
2009-02-07 22:21:31 +00:00
Chris Lattner 6726d42059 remove two eroneous suffixes, these promote to int. Thanks to Neil
for pointing this out.

llvm-svn: 64011
2009-02-07 08:49:37 +00:00
Chris Lattner a7cc1267cf fix some missing parens, thanks for Eli's review!
Obviously I make a miserable header developer :)

llvm-svn: 64009
2009-02-07 06:42:04 +00:00
Chris Lattner 5455db4273 make sure that UINTMAX_MAX has an unsigned type. This assumes that
uintmax_t is unsigned long long, which is not optimal, but is assumed 
elsewhere already.

llvm-svn: 64007
2009-02-07 06:38:06 +00:00
Chris Lattner 6bda45cec0 make various MAX/MIN constants be preprocessor constants, not C constants.
Thanks to Eli for pointing this out.

llvm-svn: 64006
2009-02-07 06:33:44 +00:00
Chris Lattner 01af63beb4 Apparently it is important to define intptr_t and uintptr_t to
long instead of int.  This is because system heaers like to redefine
typedefs and that is an error if they don't exactly match.  Use long
for intptr_t on all systems where long is the right size.

llvm-svn: 63984
2009-02-07 00:23:17 +00:00
Sebastian Redl ad41b83816 Fix some errors in the new stdint.h.
llvm-svn: 63982
2009-02-06 23:57:52 +00:00
Chris Lattner 404c2fb9cc add a stdint.h header.
llvm-svn: 63977
2009-02-06 22:59:47 +00:00