diff --git a/configure.in b/configure.in index 35bae15eaba6..a7f77bceb1f7 100644 --- a/configure.in +++ b/configure.in @@ -2251,6 +2251,17 @@ if test "$_python_res" != 0; then fi AC_MSG_RESULT([yes]) +dnl Check for using a custom implementation +dnl ======================================================== +AC_MSG_CHECKING(for custom implementation) +if test "$MOZ_CUSTOM_STDINT_H"; then + AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H") + AC_SUBST(MOZ_CUSTOM_STDINT_H) + AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H) +else + AC_MSG_RESULT(none specified) +fi + dnl Get mozilla version from central milestone file MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir` @@ -3017,47 +3028,8 @@ else AC_MSG_RESULT(no) fi -dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t. +dnl Check for int64, uint, and uint_t. dnl ======================================================== -AC_MSG_CHECKING(for int16_t) -AC_CACHE_VAL(ac_cv_int16_t, - [AC_TRY_COMPILE([#include - #include ], - [int16_t foo = 0;], - [ac_cv_int16_t=true], - [ac_cv_int16_t=false])]) -if test "$ac_cv_int16_t" = true ; then - AC_DEFINE(HAVE_INT16_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_MSG_CHECKING(for int32_t) -AC_CACHE_VAL(ac_cv_int32_t, - [AC_TRY_COMPILE([#include - #include ], - [int32_t foo = 0;], - [ac_cv_int32_t=true], - [ac_cv_int32_t=false])]) -if test "$ac_cv_int32_t" = true ; then - AC_DEFINE(HAVE_INT32_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_MSG_CHECKING(for int64_t) -AC_CACHE_VAL(ac_cv_int64_t, - [AC_TRY_COMPILE([#include - #include ], - [int64_t foo = 0;], - [ac_cv_int64_t=true], - [ac_cv_int64_t=false])]) -if test "$ac_cv_int64_t" = true ; then - AC_DEFINE(HAVE_INT64_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi AC_MSG_CHECKING(for int64) AC_CACHE_VAL(ac_cv_int64, [AC_TRY_COMPILE([#include @@ -3097,19 +3069,6 @@ if test "$ac_cv_uint_t" = true ; then else AC_MSG_RESULT(no) fi -AC_MSG_CHECKING(for uint16_t) -AC_CACHE_VAL(ac_cv_uint16_t, - [AC_TRY_COMPILE([#include - #include ], - [uint16_t foo = 0;], - [ac_cv_uint16_t=true], - [ac_cv_uint16_t=false])]) -if test "$ac_cv_uint16_t" = true ; then - AC_DEFINE(HAVE_UINT16_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU, dnl are defined when compiling C++ but not C. Since the result of this diff --git a/content/media/webm/nsWebMReader.h b/content/media/webm/nsWebMReader.h index ae836c9798ef..3ff70da12b87 100644 --- a/content/media/webm/nsWebMReader.h +++ b/content/media/webm/nsWebMReader.h @@ -39,13 +39,18 @@ #if !defined(nsWebMReader_h_) #define nsWebMReader_h_ +#include "mozilla/StdInt.h" + #include "nsDeque.h" #include "nsBuiltinDecoderReader.h" #include "nsWebMBufferedParser.h" #include "nsAutoRef.h" #include "nestegg/nestegg.h" + +#define VPX_DONT_DEFINE_STDINT_TYPES #include "vpx/vpx_decoder.h" #include "vpx/vp8dx.h" + #ifdef MOZ_TREMOR #include "tremor/ivorbiscodec.h" #else diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h index 122a9855338c..041a8458d883 100644 --- a/gfx/2d/Types.h +++ b/gfx/2d/Types.h @@ -38,22 +38,7 @@ #ifndef MOZILLA_GFX_TYPES_H_ #define MOZILLA_GFX_TYPES_H_ -#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) -# include -#elif defined (_MSC_VER) -typedef unsigned __int8 uint8_t; -typedef __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; - -#elif defined (_AIX) -# include -#else -# include -#endif +#include "mozilla/StdInt.h" #include diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp index 2aa2822063f3..4b36aa12a86c 100644 --- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -65,6 +65,8 @@ #endif #include "GLContext.h" + +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" namespace mozilla { diff --git a/gfx/thebes/woff.h b/gfx/thebes/woff.h index 7a7022ffd970..607cae4e4fb9 100644 --- a/gfx/thebes/woff.h +++ b/gfx/thebes/woff.h @@ -40,18 +40,7 @@ /* API for the WOFF encoder and decoder */ -#ifdef _MSC_VER /* MS VC lacks inttypes.h - but we can make do with a few definitons here */ -typedef signed char int8_t; -typedef short int16_t; -typedef int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned __int64 uint64_t; -#else -#include -#endif +#include "mozilla/StdInt.h" #include /* only for FILE, needed for woffPrintStatus */ diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 1fbb238a4225..4689b718bd14 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -287,6 +287,7 @@ EXPORTS_mozilla = \ MSStdInt.h \ RangedPtr.h \ RefPtr.h \ + StdInt.h \ Types.h \ Util.h \ $(NULL) diff --git a/js/src/configure.in b/js/src/configure.in index 4f19bc78707f..32070b1e3ce0 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2107,6 +2107,17 @@ if test "$_python_res" != 0; then fi AC_MSG_RESULT([yes]) +dnl Check for using a custom implementation +dnl ======================================================== +AC_MSG_CHECKING(for custom implementation) +if test "$MOZ_CUSTOM_STDINT_H"; then + AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H") + AC_SUBST(MOZ_CUSTOM_STDINT_H) + AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H) +else + AC_MSG_RESULT(none specified) +fi + MOZ_DOING_LTO(lto_is_enabled) dnl ======================================================== @@ -2920,28 +2931,6 @@ else AC_MSG_RESULT(no) fi -dnl Find exact-width integer types, or figure them out -dnl ourselves. -dnl ======================================================== -dnl Once this is working, we can delete the code for int16_t, -dnl etc. below. - -MOZ_CHECK_HEADER(stdint.h) -if test "$ac_cv_header_stdint_h" = yes; then - AC_DEFINE(JS_HAVE_STDINT_H) -else - dnl We'll figure them out for ourselves. List more likely types - dnl earlier. If we ever really encounter a size for which none of - dnl the listed types are appropriate, we'll get a configure-time - dnl error; just add the right answer. - MOZ_N_BYTE_TYPE(JS_INT8_TYPE, 1, [char]) - MOZ_N_BYTE_TYPE(JS_INT16_TYPE, 2, [short int long]) - MOZ_N_BYTE_TYPE(JS_INT32_TYPE, 4, [int long 'long long' short]) - MOZ_N_BYTE_TYPE(JS_INT64_TYPE, 8, [int long 'long long']) - MOZ_N_BYTE_TYPE(JS_INTPTR_TYPE, sizeof (void *), - [int long 'long long' short]) -fi - MOZ_SIZE_OF_TYPE(JS_BYTES_PER_WORD, void*, 4 8) if test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "4"; then AC_DEFINE(JS_BITS_PER_WORD_LOG2, 5) @@ -2964,60 +2953,8 @@ if test "$ac_cv_header_sys_isa_defs_h" = yes; then AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H) fi -dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t. +dnl Check for uint and uint_t. dnl ======================================================== -AC_MSG_CHECKING(for int16_t) -AC_CACHE_VAL(ac_cv_int16_t, - [AC_TRY_COMPILE([#include - #include ], - [int16_t foo = 0;], - [ac_cv_int16_t=true], - [ac_cv_int16_t=false])]) -if test "$ac_cv_int16_t" = true ; then - AC_DEFINE(HAVE_INT16_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_MSG_CHECKING(for int32_t) -AC_CACHE_VAL(ac_cv_int32_t, - [AC_TRY_COMPILE([#include - #include ], - [int32_t foo = 0;], - [ac_cv_int32_t=true], - [ac_cv_int32_t=false])]) -if test "$ac_cv_int32_t" = true ; then - AC_DEFINE(HAVE_INT32_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_MSG_CHECKING(for int64_t) -AC_CACHE_VAL(ac_cv_int64_t, - [AC_TRY_COMPILE([#include - #include ], - [int64_t foo = 0;], - [ac_cv_int64_t=true], - [ac_cv_int64_t=false])]) -if test "$ac_cv_int64_t" = true ; then - AC_DEFINE(HAVE_INT64_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_MSG_CHECKING(for int64) -AC_CACHE_VAL(ac_cv_int64, - [AC_TRY_COMPILE([#include - #include ], - [int64 foo = 0;], - [ac_cv_int64=true], - [ac_cv_int64=false])]) -if test "$ac_cv_int64" = true ; then - AC_DEFINE(HAVE_INT64) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi AC_MSG_CHECKING(for uint) AC_CACHE_VAL(ac_cv_uint, [AC_TRY_COMPILE([#include @@ -3044,19 +2981,6 @@ if test "$ac_cv_uint_t" = true ; then else AC_MSG_RESULT(no) fi -AC_MSG_CHECKING(for uint16_t) -AC_CACHE_VAL(ac_cv_uint16_t, - [AC_TRY_COMPILE([#include - #include ], - [uint16_t foo = 0;], - [ac_cv_uint16_t=true], - [ac_cv_uint16_t=false])]) -if test "$ac_cv_uint16_t" = true ; then - AC_DEFINE(HAVE_UINT16_T) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU, dnl are defined when compiling C++ but not C. Since the result of this diff --git a/js/src/js-config.h.in b/js/src/js-config.h.in index c1b53f8de4dc..fb009fa86237 100644 --- a/js/src/js-config.h.in +++ b/js/src/js-config.h.in @@ -55,10 +55,6 @@ entirely too much GC. */ #undef JS_GC_ZEAL -/* Define to 1 if the standard header is present and - useable. See jstypes.h and jsstdint.h. */ -#undef JS_HAVE_STDINT_H - /* Define to 1 if the header is present and useable. See jscpucfg.h. */ #undef JS_HAVE_ENDIAN_H diff --git a/js/src/jsinttypes.h b/js/src/jsinttypes.h index 17ad539ac9f5..e7eba9f517ac 100644 --- a/js/src/jsinttypes.h +++ b/js/src/jsinttypes.h @@ -39,6 +39,8 @@ #include "js-config.h" +#include "mozilla/StdInt.h" + /* * Types: * JSInt, JSUint (for = 8, 16, 32, and 64) @@ -51,31 +53,12 @@ * JSIntPtr and JSUintPtr are signed and unsigned types capable of * holding an object pointer. * - * Use these types in public SpiderMonkey header files, not the - * corresponding types from the C standard header. Windows - * doesn't support , and Microsoft says it has no plans to - * do so in the future; this means that projects that embed - * SpiderMonkey often take matters into their own hands and define the - * standard types themselves. If we define them in our public - * headers, our definitions may conflict with embedders' (see bug - * 479258). The JS* types are in our namespace, and can be used - * without troubling anyone. - * - * Internal SpiderMonkey code wishing to use the type names ISO C - * defines in the standard header can #include - * "jsstdint.h", which provides those types regardless of whether - * itself is available. + * These typedefs were once necessary to support platforms without a working + * (i.e. MSVC++ prior to 2010). Now that we ship a custom + * for such compilers, they are no longer necessary and will likely be shortly + * removed. */ -#if defined(JS_HAVE_STDINT_H) || \ - defined(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES) - -#if defined(JS_HAVE_STDINT_H) -#include -#else -#include -#endif - typedef int8_t JSInt8; typedef int16_t JSInt16; typedef int32_t JSInt32; @@ -88,51 +71,4 @@ typedef uint32_t JSUint32; typedef uint64_t JSUint64; typedef uintptr_t JSUintPtr; -#else - -#if defined(JS_HAVE___INTN) - -typedef __int8 JSInt8; -typedef __int16 JSInt16; -typedef __int32 JSInt32; -typedef __int64 JSInt64; - -typedef unsigned __int8 JSUint8; -typedef unsigned __int16 JSUint16; -typedef unsigned __int32 JSUint32; -typedef unsigned __int64 JSUint64; - -#elif defined(JS_INT8_TYPE) - -typedef signed JS_INT8_TYPE JSInt8; -typedef signed JS_INT16_TYPE JSInt16; -typedef signed JS_INT32_TYPE JSInt32; -typedef signed JS_INT64_TYPE JSInt64; - -typedef unsigned JS_INT8_TYPE JSUint8; -typedef unsigned JS_INT16_TYPE JSUint16; -typedef unsigned JS_INT32_TYPE JSUint32; -typedef unsigned JS_INT64_TYPE JSUint64; - -#else -#error "couldn't find exact-width integer types" -#endif - -/* Microsoft Visual C/C++ defines intptr_t and uintptr_t in . */ -#if defined(JS_STDDEF_H_HAS_INTPTR_T) -#include -typedef intptr_t JSIntPtr; -typedef uintptr_t JSUintPtr; - -/* Failing that, the configure script will have found something. */ -#elif defined(JS_INTPTR_TYPE) -typedef signed JS_INTPTR_TYPE JSIntPtr; -typedef unsigned JS_INTPTR_TYPE JSUintPtr; - -#else -#error "couldn't find pointer-sized integer types" -#endif - -#endif /* JS_HAVE_STDINT_H */ - #endif /* jsinttypes_h___ */ diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index a6d871de4b6d..9f7e50aa89c5 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -86,33 +86,6 @@ using namespace js; using namespace js::types; -#ifndef JS_HAVE_STDINT_H /* Native support is innocent until proven guilty. */ - -JS_STATIC_ASSERT(uint8_t(-1) == UINT8_MAX); -JS_STATIC_ASSERT(uint16_t(-1) == UINT16_MAX); -JS_STATIC_ASSERT(uint32_t(-1) == UINT32_MAX); -JS_STATIC_ASSERT(uint64_t(-1) == UINT64_MAX); - -JS_STATIC_ASSERT(INT8_MAX > INT8_MIN); -JS_STATIC_ASSERT(uint8_t(INT8_MAX) + uint8_t(1) == uint8_t(INT8_MIN)); -JS_STATIC_ASSERT(INT16_MAX > INT16_MIN); -JS_STATIC_ASSERT(uint16_t(INT16_MAX) + uint16_t(1) == uint16_t(INT16_MIN)); -JS_STATIC_ASSERT(INT32_MAX > INT32_MIN); -JS_STATIC_ASSERT(uint32_t(INT32_MAX) + uint32_t(1) == uint32_t(INT32_MIN)); -JS_STATIC_ASSERT(INT64_MAX > INT64_MIN); -JS_STATIC_ASSERT(uint64_t(INT64_MAX) + uint64_t(1) == uint64_t(INT64_MIN)); - -JS_STATIC_ASSERT(INTPTR_MAX > INTPTR_MIN); -JS_STATIC_ASSERT(uintptr_t(INTPTR_MAX) + uintptr_t(1) == uintptr_t(INTPTR_MIN)); -JS_STATIC_ASSERT(uintptr_t(-1) == UINTPTR_MAX); -JS_STATIC_ASSERT(size_t(-1) == SIZE_MAX); -JS_STATIC_ASSERT(PTRDIFF_MAX > PTRDIFF_MIN); -JS_STATIC_ASSERT(ptrdiff_t(PTRDIFF_MAX) == PTRDIFF_MAX); -JS_STATIC_ASSERT(ptrdiff_t(PTRDIFF_MIN) == PTRDIFF_MIN); -JS_STATIC_ASSERT(uintptr_t(PTRDIFF_MAX) + uintptr_t(1) == uintptr_t(PTRDIFF_MIN)); - -#endif /* JS_HAVE_STDINT_H */ - /* * If we're accumulating a decimal number and the number is >= 2^53, then the * fast result from the loop in GetPrefixInteger may be inaccurate. Call diff --git a/js/src/jsstdint.h b/js/src/jsstdint.h index 446a87319ac0..900a2ddf321d 100644 --- a/js/src/jsstdint.h +++ b/js/src/jsstdint.h @@ -38,85 +38,12 @@ * ***** END LICENSE BLOCK ***** */ /* - * This header provides definitions for the types we use, - * even on systems that lack . - * - * NOTE: This header should only be included in private SpiderMonkey - * code; public headers should use only the JS{Int,Uint}N types; see - * the comment for them in "jsinttypes.h". - * - * At the moment, these types are not widely used within SpiderMonkey; - * this file is meant to make existing uses portable, and to allow us - * to transition portably to using them more, if desired. + * This header implements the functionality of , even on systems that + * lack it. It does so by completely delegating to a separate header, which + * could just as easily be used. However, as this header is part of the + * SpiderMonkey interface, we retain it for compatibility. */ - #ifndef jsstdint_h___ #define jsstdint_h___ - -#include "jsinttypes.h" - -/* If we have a working stdint.h, then jsinttypes.h has already - defined the standard integer types. Otherwise, define the standard - names in terms of the 'JS' types. */ -#if ! defined(JS_HAVE_STDINT_H) && \ - ! defined(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES) - -typedef JSInt8 int8_t; -typedef JSInt16 int16_t; -typedef JSInt32 int32_t; -typedef JSInt64 int64_t; - -typedef JSUint8 uint8_t; -typedef JSUint16 uint16_t; -typedef JSUint32 uint32_t; -typedef JSUint64 uint64_t; - -/* Suppress other, conflicting attempts to define stdint-bits. */ -#define _STDINT_H - -/* If JS_STDDEF_H_HAS_INTPTR_T or JS_CRTDEFS_H_HAS_INTPTR_T are - defined, then jsinttypes.h included the given header, which - introduced definitions for intptr_t and uintptr_t. Otherwise, - define the standard names in terms of the 'JS' types. */ -#if !defined(JS_STDDEF_H_HAS_INTPTR_T) && !defined(JS_CRTDEFS_H_HAS_INTPTR_T) -typedef JSIntPtr intptr_t; -typedef JSUintPtr uintptr_t; -#endif - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -#define INT8_MAX 127 -#define INT8_MIN (-INT8_MAX - 1) -#define INT16_MAX 32767 -#define INT16_MIN (-INT16_MAX - 1) -#define INT32_MAX 2147483647 -#define INT32_MIN (-INT32_MAX - 1) -#define INT64_MAX 9223372036854775807LL -#define INT64_MIN (-INT64_MAX - 1) - -#define UINT8_MAX 255 -#define UINT16_MAX 65535 -#define UINT32_MAX 4294967295U -#define UINT64_MAX 18446744073709551615ULL - -/* - * These are technically wrong as they can't be used in the preprocessor, but - * we would require compiler assistance, and at the moment we don't need - * preprocessor-correctness. - */ -#ifdef _MSC_VER -#undef SIZE_MAX -#endif - -#define INTPTR_MAX ((intptr_t) (UINTPTR_MAX >> 1)) -#define INTPTR_MIN (intptr_t(uintptr_t(INTPTR_MAX) + uintptr_t(1))) -#define UINTPTR_MAX ((uintptr_t) -1) -#define SIZE_MAX UINTPTR_MAX -#define PTRDIFF_MAX INTPTR_MAX -#define PTRDIFF_MIN INTPTR_MIN - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - -#endif /* JS_HAVE_STDINT_H */ - +#include "mozilla/StdInt.h" #endif /* jsstdint_h___ */ diff --git a/mfbt/StdInt.h b/mfbt/StdInt.h new file mode 100644 index 000000000000..3638439517dc --- /dev/null +++ b/mfbt/StdInt.h @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=99 ft=cpp: + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Code. + * + * The Initial Developer of the Original Code is + * The Mozilla Foundation + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jeff Walden (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implements the C99 interface for C and C++ code. */ + +#ifndef mozilla_StdInt_h_ +#define mozilla_StdInt_h_ + +/* + * The C99 standard header exposes typedefs for common fixed-width + * integer types. It would be feasible to simply #include , but + * MSVC++ versions prior to 2010 don't provide . We could solve this + * by reimplementing for MSVC++ 2008 and earlier. But then we reach + * a second problem: our custom might conflict with a + * defined by an embedder already looking to work around the MSVC++ + * absence. + * + * We address these issues in this manner: + * + * 1. If the preprocessor macro MOZ_CUSTOM_STDINT_H is defined to a path to a + * custom implementation, we will #include it. Embedders using + * a custom must define this macro to an implementation that + * will work with their embedding. + * 2. Otherwise, if we are compiling with a an MSVC++ version without + * , #include our custom reimplementation. + * 3. Otherwise, #include the standard provided by the compiler. + */ +#if defined(MOZ_CUSTOM_STDINT_H) +# include MOZ_CUSTOM_STDINT_H +#elif defined(_MSC_VER) && _MSC_VER < 1600 +# include "mozilla/MSStdInt.h" +#else +# include +#endif + +#endif /* mozilla_StdInt_h_ */ diff --git a/mfbt/Types.h b/mfbt/Types.h index cf73f18b5a19..7d970cdee797 100644 --- a/mfbt/Types.h +++ b/mfbt/Types.h @@ -45,6 +45,14 @@ #ifndef mozilla_Types_h_ #define mozilla_Types_h_ +/* + * Expose the standard integer types from (and the integer type + * limit and constant macros, if the right __STDC_*_MACRO has been defined for + * each). These are all usable throughout mfbt code, and throughout Mozilla + * code more generally. + */ +#include "mozilla/StdInt.h" + /* * mfbt is logically "lower level" than js/src, but needs basic * definitions of numerical types and macros for compiler/linker @@ -59,18 +67,6 @@ */ #include "jstypes.h" -/* - * The numerical types provided by jstypes.h that are allowed within - * mfbt code are - * - * stddef types: size_t, ptrdiff_t, etc. - * stdin [sic] types: int8, uint32, etc. - * - * stdint types (int8_t etc.), are available for use here, but doing - * so would change SpiderMonkey's and Gecko's contracts with - * embedders: stdint types have not yet appeared in public APIs. - */ - #define MOZ_EXPORT_API(type_) JS_EXPORT_API(type_) #define MOZ_IMPORT_API(type_) JS_IMPORT_API(type_) diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp index f0f322068605..2b627a674ef1 100644 --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -142,6 +142,7 @@ static const char sGconfAccessibilityKey[] = "/desktop/gnome/interface/accessibi #include "nsAutoPtr.h" extern "C" { +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" } #include "gfxPlatformGtk.h" diff --git a/widget/src/qt/nsWindow.cpp b/widget/src/qt/nsWindow.cpp index 8c4afea0f0a3..90c7dfd091b0 100644 --- a/widget/src/qt/nsWindow.cpp +++ b/widget/src/qt/nsWindow.cpp @@ -150,6 +150,7 @@ static Atom sPluginIMEAtom = nsnull; #include "nsShmImage.h" extern "C" { +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" } diff --git a/widget/src/windows/nsWindowGfx.cpp b/widget/src/windows/nsWindowGfx.cpp index aea396844ea7..85314cb50dea 100644 --- a/widget/src/windows/nsWindowGfx.cpp +++ b/widget/src/windows/nsWindowGfx.cpp @@ -79,6 +79,7 @@ using mozilla::plugins::PluginInstanceParent; #include "nsUXThemeConstants.h" extern "C" { +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" }