author | Jeff Walden <jwalden@mit.edu> |
Tue, 22 Nov 2011 17:42:57 -0800 | |
changeset 83922 | 987a82806246dadc9c4562209d2a8a9f7b880f47 |
parent 83921 | 76190177b149f7df0a7fb6a901b5a61956a47649 |
child 83923 | af13b9729453b8a06f5f9b2ee7ff8893057bc47d |
push id | 519 |
push user | akeybl@mozilla.com |
push date | Wed, 01 Feb 2012 00:38:35 +0000 |
treeherder | mozilla-beta@788ea1ef610b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | cjones |
bugs | 704313 |
milestone | 11.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/configure.in +++ b/configure.in @@ -2246,16 +2246,27 @@ changequote(,) $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION _python_res=$? changequote([,]) if test "$_python_res" != 0; then AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.]) fi AC_MSG_RESULT([yes]) +dnl Check for using a custom <stdint.h> implementation +dnl ======================================================== +AC_MSG_CHECKING(for custom <stdint.h> 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` dnl Get version of various core apps from the version files. FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt` if test -z "$FIREFOX_VERSION"; then AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.]) @@ -3012,57 +3023,18 @@ AC_CACHE_VAL(ac_cv_siginfo_t, [ac_cv_siginfo_t=false])]) if test "$ac_cv_siginfo_t" = true ; then AC_DEFINE(HAVE_SIGINFO_T) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t. -dnl ======================================================== -AC_MSG_CHECKING(for int16_t) -AC_CACHE_VAL(ac_cv_int16_t, - [AC_TRY_COMPILE([#include <stdio.h> - #include <sys/types.h>], - [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 <stdio.h> - #include <sys/types.h>], - [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 <stdio.h> - #include <sys/types.h>], - [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 +dnl Check for int64, uint, and uint_t. +dnl ======================================================== AC_MSG_CHECKING(for int64) AC_CACHE_VAL(ac_cv_int64, [AC_TRY_COMPILE([#include <stdio.h> #include <sys/types.h>], [int64 foo = 0;], [ac_cv_int64=true], [ac_cv_int64=false])]) if test "$ac_cv_int64" = true ; then @@ -3092,29 +3064,16 @@ AC_CACHE_VAL(ac_cv_uint_t, [ac_cv_uint_t=true], [ac_cv_uint_t=false])]) if test "$ac_cv_uint_t" = true ; then AC_DEFINE(HAVE_UINT_T) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -AC_MSG_CHECKING(for uint16_t) -AC_CACHE_VAL(ac_cv_uint16_t, - [AC_TRY_COMPILE([#include <stdio.h> - #include <sys/types.h>], - [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 dnl test is used only in C++, do it in C++. AC_LANG_CPLUSPLUS AC_MSG_CHECKING(for uname.domainname) AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
--- a/content/media/webm/nsWebMReader.h +++ b/content/media/webm/nsWebMReader.h @@ -34,23 +34,28 @@ * 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 ***** */ #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 #include "vorbis/codec.h" #endif class nsMediaDecoder;
--- a/gfx/2d/Types.h +++ b/gfx/2d/Types.h @@ -33,32 +33,17 @@ * 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 ***** */ #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 <inttypes.h> -#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 <sys/inttypes.h> -#else -# include <stdint.h> -#endif +#include "mozilla/StdInt.h" #include <stddef.h> namespace mozilla { namespace gfx { typedef float Float;
--- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -60,16 +60,18 @@ #include "ThebesLayerBuffer.h" #include "nsIWidget.h" #include "ReadbackProcessor.h" #ifdef MOZ_X11 #include "gfxXlibSurface.h" #endif #include "GLContext.h" + +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" namespace mozilla { namespace layers { class BasicContainerLayer; class ShadowableLayer;
--- a/gfx/thebes/woff.h +++ b/gfx/thebes/woff.h @@ -35,28 +35,17 @@ * * ***** END LICENSE BLOCK ***** */ #ifndef WOFF_H_ #define WOFF_H_ /* 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 <inttypes.h> -#endif +#include "mozilla/StdInt.h" #include <stdio.h> /* only for FILE, needed for woffPrintStatus */ /* error codes returned in the status parameter of WOFF functions */ enum { /* Success */ eWOFF_ok = 0,
--- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -282,16 +282,17 @@ VPATH += \ EXPORTS_NAMESPACES += mozilla EXPORTS_mozilla = \ Attributes.h \ GuardObjects.h \ MSStdInt.h \ RangedPtr.h \ RefPtr.h \ + StdInt.h \ Types.h \ Util.h \ $(NULL) ifdef ENABLE_METHODJIT ############################################### # BEGIN include sources for the method JIT
--- a/js/src/configure.in +++ b/js/src/configure.in @@ -2102,16 +2102,27 @@ changequote(,) $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION _python_res=$? changequote([,]) if test "$_python_res" != 0; then AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.]) fi AC_MSG_RESULT([yes]) +dnl Check for using a custom <stdint.h> implementation +dnl ======================================================== +AC_MSG_CHECKING(for custom <stdint.h> 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 ======================================================== dnl System overrides of the defaults for target dnl ======================================================== case "$target" in *-aix*) @@ -2915,38 +2926,16 @@ AC_CACHE_VAL(ac_cv_siginfo_t, [ac_cv_siginfo_t=false])]) if test "$ac_cv_siginfo_t" = true ; then AC_DEFINE(HAVE_SIGINFO_T) AC_MSG_RESULT(yes) 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) elif test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "8"; then AC_DEFINE(JS_BITS_PER_WORD_LOG2, 6) else AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD]) fi @@ -2959,70 +2948,18 @@ if test "$ac_cv_header_endian_h" = yes; AC_DEFINE(JS_HAVE_ENDIAN_H) fi MOZ_CHECK_HEADERS(sys/isa_defs.h) 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 <stdio.h> - #include <sys/types.h>], - [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 <stdio.h> - #include <sys/types.h>], - [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 <stdio.h> - #include <sys/types.h>], - [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 <stdio.h> - #include <sys/types.h>], - [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 <stdio.h> #include <sys/types.h>], [uint foo = 0;], [ac_cv_uint=true], [ac_cv_uint=false])]) if test "$ac_cv_uint" = true ; then @@ -3039,29 +2976,16 @@ AC_CACHE_VAL(ac_cv_uint_t, [ac_cv_uint_t=true], [ac_cv_uint_t=false])]) if test "$ac_cv_uint_t" = true ; then AC_DEFINE(HAVE_UINT_T) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -AC_MSG_CHECKING(for uint16_t) -AC_CACHE_VAL(ac_cv_uint16_t, - [AC_TRY_COMPILE([#include <stdio.h> - #include <sys/types.h>], - [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 dnl test is used only in C++, do it in C++. AC_LANG_CPLUSPLUS AC_MSG_CHECKING(for uname.domainname) AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
--- a/js/src/js-config.h.in +++ b/js/src/js-config.h.in @@ -50,20 +50,16 @@ /* Define to 1 if SpiderMonkey should include ctypes support. */ #undef JS_HAS_CTYPES /* Define to 1 if SpiderMonkey should support the ability to perform entirely too much GC. */ #undef JS_GC_ZEAL -/* Define to 1 if the standard <stdint.h> header is present and - useable. See jstypes.h and jsstdint.h. */ -#undef JS_HAVE_STDINT_H - /* Define to 1 if the <endian.h> header is present and useable. See jscpucfg.h. */ #undef JS_HAVE_ENDIAN_H /* Define to 1 if the <sys/isa_defs.h> header is present and useable. See jscpucfg.h. */ #undef JS_HAVE_SYS_ISA_DEFS_H
--- a/js/src/jsinttypes.h +++ b/js/src/jsinttypes.h @@ -34,105 +34,41 @@ * * ***** END LICENSE BLOCK ***** */ #ifndef jsinttypes_h___ #define jsinttypes_h___ #include "js-config.h" +#include "mozilla/StdInt.h" + /* * Types: * JSInt<N>, JSUint<N> (for <N> = 8, 16, 32, and 64) * JSIntPtr, JSUIntPtr * * JSInt<N> and JSUint<N> are signed and unsigned types known to be * <N> bits long. Note that neither JSInt8 nor JSUInt8 is necessarily * equivalent to a plain "char". * * 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 <stdint.h> header. Windows - * doesn't support <stdint.h>, 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 <stdint.h> can #include - * "jsstdint.h", which provides those types regardless of whether - * <stdint.h> itself is available. + * These typedefs were once necessary to support platforms without a working + * <stdint.h> (i.e. MSVC++ prior to 2010). Now that we ship a custom <stdint.h> + * 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 <stdint.h> -#else -#include <sys/types.h> -#endif - typedef int8_t JSInt8; typedef int16_t JSInt16; typedef int32_t JSInt32; typedef int64_t JSInt64; typedef intptr_t JSIntPtr; typedef uint8_t JSUint8; typedef uint16_t JSUint16; 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 <stddef.h>. */ -#if defined(JS_STDDEF_H_HAS_INTPTR_T) -#include <stddef.h> -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___ */
--- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -81,43 +81,16 @@ #include "jsstrinlines.h" #include "vm/NumberObject-inl.h" #include "vm/String-inl.h" 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 * js_strtod_harder to get the correct answer. */ static bool ComputeAccurateDecimalInteger(JSContext *cx, const jschar *start, const jschar *end, jsdouble *dp) {
--- a/js/src/jsstdint.h +++ b/js/src/jsstdint.h @@ -33,90 +33,17 @@ * 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 ***** */ /* - * This header provides definitions for the <stdint.h> types we use, - * even on systems that lack <stdint.h>. - * - * 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 <stdint.h>, 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___ */
new file mode 100644 --- /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 <jwalden+code@mit.edu> (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 <stdint.h> interface for C and C++ code. */ + +#ifndef mozilla_StdInt_h_ +#define mozilla_StdInt_h_ + +/* + * The C99 standard header <stdint.h> exposes typedefs for common fixed-width + * integer types. It would be feasible to simply #include <stdint.h>, but + * MSVC++ versions prior to 2010 don't provide <stdint.h>. We could solve this + * by reimplementing <stdint.h> for MSVC++ 2008 and earlier. But then we reach + * a second problem: our custom <stdint.h> might conflict with a <stdint.h> + * defined by an embedder already looking to work around the MSVC++ <stdint.h> + * 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 <stdint.h> implementation, we will #include it. Embedders using + * a custom <stdint.h> 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 + * <stdint.h>, #include our custom <stdint.h> reimplementation. + * 3. Otherwise, #include the standard <stdint.h> 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 <stdint.h> +#endif + +#endif /* mozilla_StdInt_h_ */
--- a/mfbt/Types.h +++ b/mfbt/Types.h @@ -40,42 +40,38 @@ /* * NB: This header must be both valid C and C++. It must be * include-able by code embedding SpiderMonkey *and* Gecko. */ #ifndef mozilla_Types_h_ #define mozilla_Types_h_ +/* + * Expose the standard integer types from <stdint.h> (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 * directives. js/src already goes through some pain to provide them * on numerous platforms, so instead of moving all that goop here, * this header makes use of the fact that for the foreseeable future * mfbt code will be part and parcel with libmozjs, static or not. * * For now, the policy is to use jstypes definitions but add a layer * of indirection on top of them in case a Great Refactoring ever * happens. */ #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_) /* * mfbt definitions need to see export declarations when built, but * other code needs to see import declarations when using mfbt. */ #if defined(IMPL_MFBT)
--- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -137,16 +137,17 @@ static const char sGconfAccessibilityKey #include <wchar.h> #include "imgIContainer.h" #include "nsGfxCIID.h" #include "nsImageToPixbuf.h" #include "nsIInterfaceRequestorUtils.h" #include "nsAutoPtr.h" extern "C" { +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" } #include "gfxPlatformGtk.h" #include "gfxContext.h" #include "gfxImageSurface.h" #include "gfxUtils.h" #include "Layers.h" #include "LayerManagerOGL.h"
--- a/widget/src/qt/nsWindow.cpp +++ b/widget/src/qt/nsWindow.cpp @@ -145,16 +145,17 @@ static Atom sPluginIMEAtom = nsnull; #include "nsFastStartupQt.h" // If embedding clients want to create widget without real parent window // then nsIBaseWindow->Init() should have parent argument equal to PARENTLESS_WIDGET #define PARENTLESS_WIDGET (void*)0x13579 #include "nsShmImage.h" extern "C" { +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" } using namespace mozilla; using namespace mozilla::widget; // imported in nsWidgetFactory.cpp bool gDisableNativeTheme = false;
--- a/widget/src/windows/nsWindowGfx.cpp +++ b/widget/src/windows/nsWindowGfx.cpp @@ -74,16 +74,17 @@ using mozilla::plugins::PluginInstancePa #ifdef MOZ_ENABLE_D3D10_LAYER #include "LayerManagerD3D10.h" #endif #include "nsUXThemeData.h" #include "nsUXThemeConstants.h" extern "C" { +#define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" } using namespace mozilla::layers; /************************************************************** ************************************************************** **