mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 895047 - Make char16_t available everywhere and use that to define PRUnichar and jschar; r=jcranmer,jorendorff,glandium
This commit is contained in:
parent
ce12070342
commit
b7d148db05
2
CLOBBER
2
CLOBBER
@ -18,4 +18,4 @@
|
||||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
|
||||
Bug 872934 - Clobber needed for webidl updates for style sheet change events. Again and again.
|
||||
Bug 895047 - Clobber needed for touching js/src/js-confdefs.h.in
|
||||
|
@ -16,6 +16,8 @@ WRAP_LDFLAGS=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DELFHACK_BUILD
|
||||
|
||||
test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack $(filter inject/%,$(CSRCS:.c=.$(OBJ_SUFFIX)))
|
||||
$(MKSHLIB) $(LDFLAGS) $< -nostartfiles
|
||||
@echo ===
|
||||
|
@ -30,5 +30,7 @@ $(CSRCS): %.c: ../inject.c
|
||||
|
||||
GARBAGE += $(CSRCS)
|
||||
|
||||
DEFINES += -DELFHACK_BUILD
|
||||
|
||||
CFLAGS := -O2 -fno-stack-protector $(filter -m% -I%,$(CFLAGS))
|
||||
$(CPU)-noinit.$(OBJ_SUFFIX): DEFINES += -DNOINIT
|
||||
|
@ -128,7 +128,7 @@ GARBAGE += \
|
||||
ifndef CROSS_COMPILE
|
||||
ifdef USE_ELF_DYNSTR_GC
|
||||
elf-dynstr-gc: elf-dynstr-gc.c $(GLOBAL_DEPS) $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(CC) $(COMPILE_CFLAGS) $(GLIB_CFLAGS) -o $@ $< $(LDFLAGS) $(GLIB_LIBS)
|
||||
$(CC) $(COMPILE_CFLAGS) $(GLIB_CFLAGS) -DELFDYNSTRGC_BUILD -o $@ $< $(LDFLAGS) $(GLIB_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -50,11 +50,7 @@ struct jsid;
|
||||
typedef ptrdiff_t jsid;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
typedef wchar_t jschar;
|
||||
#else
|
||||
typedef uint16_t jschar;
|
||||
#endif
|
||||
typedef char16_t jschar;
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
@ -10,4 +10,6 @@
|
||||
|
||||
#include "js/RequiredDefines.h"
|
||||
|
||||
#include "mozilla/Char16.h"
|
||||
|
||||
#endif /* js_confdefs_h */
|
||||
|
@ -14,9 +14,6 @@
|
||||
* character literals. C++11's char16_t is a distinct builtin type. C11's
|
||||
* char16_t is a typedef for uint_least16_t. Technically, char16_t is a 16-bit
|
||||
* code unit of a Unicode code point, not a "character".
|
||||
*
|
||||
* For now, Char16.h only supports C++ because we don't want mix different C
|
||||
* and C++ definitions of char16_t in the same code base.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -39,10 +36,26 @@
|
||||
* typedef from wchar_t.
|
||||
*/
|
||||
# define MOZ_CHAR16_IS_NOT_WCHAR
|
||||
#elif !defined(__cplusplus)
|
||||
# if defined(WIN32)
|
||||
# include <yvals.h>
|
||||
typedef wchar_t char16_t;
|
||||
# else
|
||||
/**
|
||||
* We can't use the stdint.h uint16_t type here because including
|
||||
* stdint.h will break building some of our C libraries, such as
|
||||
* sqlite.
|
||||
*/
|
||||
typedef unsigned short char16_t;
|
||||
# endif
|
||||
#else
|
||||
# error "Char16.h requires C++11 (or something like it) for UTF-16 support."
|
||||
#endif
|
||||
|
||||
/* This is a temporary hack until bug 927728 is fixed. */
|
||||
#define __PRUNICHAR__
|
||||
typedef char16_t PRUnichar;
|
||||
|
||||
/*
|
||||
* Macro arguments used in concatenation or stringification won't be expanded.
|
||||
* Therefore, in order for |MOZ_UTF16(FOO)| to work as expected (which is to
|
||||
@ -53,9 +66,12 @@
|
||||
*/
|
||||
#define MOZ_UTF16(s) MOZ_UTF16_HELPER(s)
|
||||
|
||||
#if defined(__cplusplus) && \
|
||||
(__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__))
|
||||
static_assert(sizeof(char16_t) == 2, "Is char16_t type 16 bits?");
|
||||
static_assert(char16_t(-1) > char16_t(0), "Is char16_t type unsigned?");
|
||||
static_assert(sizeof(MOZ_UTF16('A')) == 2, "Is char literal 16 bits?");
|
||||
static_assert(sizeof(MOZ_UTF16("")[0]) == 2, "Is string char 16 bits?");
|
||||
#endif
|
||||
|
||||
#endif /* mozilla_Char16_h */
|
||||
|
@ -25,6 +25,19 @@
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force-include Char16.h in order to define PRUnichar as char16_t everywhere.
|
||||
* Note that this should be the first #include to make sure that prtypes.h does
|
||||
* not attempt to define PRUnichar. This includes the following hunspell-specific
|
||||
* includes.
|
||||
*
|
||||
* We don't use this to build elfhack and elf-dynstr-gc since those builds happen
|
||||
* during the export tier. Also, disable this when building assembly files too.
|
||||
*/
|
||||
#if !defined(ELFHACK_BUILD) && !defined(ELFDYNSTRGC_BUILD) && !defined(__ASSEMBLER__)
|
||||
#include "mozilla/Char16.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force-include hunspell_alloc_hooks.h and hunspell_fopen_hooks.h for hunspell,
|
||||
* so that we don't need to modify them directly.
|
||||
|
@ -325,18 +325,6 @@ typedef unsigned long nsrefcnt;
|
||||
typedef uint32_t nsrefcnt;
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Casting macros for hiding C++ features from older compilers */
|
||||
|
||||
#ifndef __PRUNICHAR__
|
||||
#define __PRUNICHAR__
|
||||
#if defined(WIN32)
|
||||
typedef wchar_t PRUnichar;
|
||||
#else
|
||||
typedef uint16_t PRUnichar;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use these macros to do 64bit safe pointer conversions.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user