Bug 945029 - Fix up Android's broken [u]intptr_t inttype macros. r=Waldo

This commit is contained in:
Chris Peterson 2014-05-12 22:27:14 -07:00
parent c82feb3ba9
commit c204165da0
6 changed files with 35 additions and 16 deletions

View File

@ -243,7 +243,3 @@ LOCAL_INCLUDES += [
'/netwerk/base/src',
'/xpcom/ds',
]
if CONFIG['GNU_CC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
# Work around bug 986928
CXXFLAGS += ['-Wno-error=format']

View File

@ -30,7 +30,3 @@ LOCAL_INCLUDES += [
RESOURCE_FILES.dtd += [
'htmlmathml-f.ent',
]
if CONFIG['GNU_CC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
# Work around bug 986928
CXXFLAGS += ['-Wno-error=format']

View File

@ -37,4 +37,25 @@
# include <inttypes.h>
#endif
/*
* Fix up Android's broken [u]intptr_t inttype macros. Android's PRI*PTR
* macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
* is 4 on 32-bit Android. TestTypeTraits.cpp asserts that these new macro
* definitions match the actual type sizes seen at compile time.
*/
#if defined(ANDROID) && !defined(__LP64__)
# undef PRIdPTR /* intptr_t */
# define PRIdPTR "d" /* intptr_t */
# undef PRIiPTR /* intptr_t */
# define PRIiPTR "i" /* intptr_t */
# undef PRIoPTR /* uintptr_t */
# define PRIoPTR "o" /* uintptr_t */
# undef PRIuPTR /* uintptr_t */
# define PRIuPTR "u" /* uintptr_t */
# undef PRIxPTR /* uintptr_t */
# define PRIxPTR "x" /* uintptr_t */
# undef PRIXPTR /* uintptr_t */
# define PRIXPTR "X" /* uintptr_t */
#endif
#endif /* mozilla_IntegerPrintfMacros_h_ */

View File

@ -292,6 +292,20 @@ static_assert(IsSame<MakeUnsigned<volatile char>::Type, volatile unsigned char>:
static_assert(IsSame<MakeUnsigned<const char>::Type, const unsigned char>::value,
"const char won't unsignify correctly");
/*
* Android's broken [u]intptr_t inttype macros are broken because its PRI*PTR
* macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
* is 4 on 32-bit Android. We redefine Android's PRI*PTR macros in
* IntegerPrintfMacros.h and assert here that our new definitions match the
* actual type sizes seen at compile time.
*/
#if defined(ANDROID) && !defined(__LP64__)
static_assert(mozilla::IsSame<int, intptr_t>::value,
"emulated PRI[di]PTR definitions will be wrong");
static_assert(mozilla::IsSame<unsigned int, uintptr_t>::value,
"emulated PRI[ouxX]PTR definitions will be wrong");
#endif
int
main()
{

View File

@ -15,7 +15,3 @@ FAIL_ON_WARNINGS = True
MSVC_ENABLE_PGO = True
FINAL_LIBRARY = 'gklayout'
if CONFIG['GNU_CC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
# Work around bug 986928
CXXFLAGS += ['-Wno-error=format']

View File

@ -156,7 +156,3 @@ LOCAL_INCLUDES += [
if CONFIG['MOZ_OPTIMIZE']:
DEFINES['MOZ_OPTIMIZE'] = True
if CONFIG['GNU_CC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
# Work around bug 986928
CXXFLAGS += ['-Wno-error=format']