mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 795433 - Use #define for nsresult values in C code. r=ehsan,glandium; feedback=njn
This commit is contained in:
parent
8ae53d36e8
commit
b18db0e9e8
@ -109,7 +109,8 @@ SDK_HEADERS = \
|
||||
nsAutoPtr.h \
|
||||
nsError.h \
|
||||
ErrorList.h \
|
||||
ErrorListDefines.h \
|
||||
ErrorListCxxDefines.h \
|
||||
ErrorListCDefines.h \
|
||||
nsISupportsBase.h \
|
||||
nscore.h \
|
||||
nsAtomicRefcnt.h \
|
||||
@ -163,10 +164,16 @@ LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/xpcom/ds \
|
||||
$(NULL)
|
||||
|
||||
# We generate ErrorListDefines.h from ErrorList.h using regex. The -n option
|
||||
# We generate ErrorListCxxDefines.h from ErrorList.h using regex. The -n option
|
||||
# suppresses printing the pattern space, and the p at the end prints it anyway,
|
||||
# so we don't print lines that don't match the pattern to start with.
|
||||
ErrorListDefines.h: ErrorList.h
|
||||
ErrorListCxxDefines.h: ErrorList.h Makefile
|
||||
sed -n 's/.*ERROR(\([A-Z_0-9]*\).*/#define \1 nsresult::\1/p' < $< > $@
|
||||
|
||||
GARBAGE += ErrorListDefines.h
|
||||
ErrorListCDefines.h: ErrorList.h Makefile
|
||||
sed 's/.*ERROR(\([A-Z_0-9]*\),\( *\)\(.*\))[^)]*/#define \1 \2((nsresult)(\3))/' < $< > $@
|
||||
|
||||
GARBAGE += \
|
||||
ErrorListCxxDefines.h \
|
||||
ErrorListCDefines.h \
|
||||
$(NULL)
|
||||
|
@ -117,16 +117,16 @@
|
||||
* return foo ? F() : NS_ERROR_FAILURE;
|
||||
* to fail, because nsresult and nsresult::Enum are two distinct types and
|
||||
* either can be converted to the other, so it's ambiguous. So we have to fall
|
||||
* back to a regular enum. Fortunately, we need to support that anyway for the
|
||||
* sake of C, so it's not a big deal.
|
||||
* back to a regular enum.
|
||||
*/
|
||||
#if defined(__cplusplus) && defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
||||
#if defined(__cplusplus)
|
||||
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
||||
typedef enum class tag_nsresult : uint32_t
|
||||
#elif defined(__cplusplus) && defined(MOZ_HAVE_CXX11_ENUM_TYPE)
|
||||
#elif defined(MOZ_HAVE_CXX11_ENUM_TYPE)
|
||||
/* Need underlying type for workaround of Microsoft compiler (Bug 794734) */
|
||||
typedef enum tag_nsresult : uint32_t
|
||||
#else
|
||||
/* C, or no strong enums */
|
||||
/* no strong enums */
|
||||
typedef enum tag_nsresult
|
||||
#endif
|
||||
{
|
||||
@ -136,11 +136,18 @@
|
||||
#undef ERROR
|
||||
} nsresult;
|
||||
|
||||
#if defined(__cplusplus) && defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
||||
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
||||
/* We're using enum classes, so we need #define's to put the constants in
|
||||
* global scope for compatibility with old code. */
|
||||
#include "ErrorListDefines.h"
|
||||
#include "ErrorListCxxDefines.h"
|
||||
#endif
|
||||
#else /* defined(__cplusplus) */
|
||||
/* C enum can't have a value outside the range of 'int'.
|
||||
* C const can't initialize with an expression involving other variables
|
||||
* even if it is const. So we have to fall back to bad old #defines. */
|
||||
typedef uint32_t nsresult;
|
||||
#include "ErrorListCDefines.h"
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#undef SUCCESS_OR_FAILURE
|
||||
#undef SUCCESS
|
||||
|
@ -32,6 +32,7 @@ DEFINES += -DEXPORT_XPT_API
|
||||
# Build libxpt early so that it'll be available to xpidl, which also
|
||||
# must be built early.
|
||||
export::
|
||||
@$(MAKE) -C ../../../base ErrorListCDefines.h
|
||||
@$(MAKE) libs
|
||||
|
||||
# XXX, bug 417045, make -jN combines badly with -save-temps in
|
||||
@ -46,5 +47,6 @@ endif
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I../../../ \
|
||||
-I../../../base \
|
||||
-I$(topsrcdir)/xpcom/base \
|
||||
$(NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user