Bug 786533 - On Windows, one of the system header files (windef.h) defines 'min' and 'max' as macros which breaks any use of std::min/std::max. Define NOMINMAX before including system header files where needed to avoid defining those macros. r=ehsan

This commit is contained in:
Mats Palmgren 2013-01-15 13:22:03 +01:00
Родитель 865cec14e9
Коммит 922a941b05
9 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -39,6 +39,10 @@ EXPORTS = \
ia2AccessibleText.h \
$(NULL)
# The midl generated code include Windows headers which defines min and max
# macros which conflicts with std::min/max. Suppress the macros:
OS_CXXFLAGS += -DNOMINMAX
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1

Просмотреть файл

@ -13,6 +13,9 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_sdn_s
EXPORT_LIBRARY = 1
LIBXUL_LIBRARY = 1
# The midl generated code include Windows headers which defines min and max
# macros which conflicts with std::min/max. Suppress the macros:
OS_CXXFLAGS += -DNOMINMAX
CPPSRCS += \
sdnAccessible.cpp \

Просмотреть файл

@ -13,6 +13,9 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_uia_s
EXPORT_LIBRARY = ..
LIBXUL_LIBRARY = 1
# The midl generated code include Windows headers which defines min and max
# macros which conflicts with std::min/max. Suppress the macros:
OS_CXXFLAGS += -DNOMINMAX
CPPSRCS += \

Просмотреть файл

@ -17,6 +17,11 @@
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
#ifdef _WIN32
// Suppress windef.h min and max macros - they make std::min/max not compile.
#define NOMINMAX 1
#endif
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//

Просмотреть файл

@ -12,6 +12,9 @@
# error "STL code can only be used with -fno-exceptions"
#endif
// Suppress windef.h min and max macros - they make std::min/max not compile.
#define NOMINMAX 1
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h

Просмотреть файл

@ -34,6 +34,10 @@ CPPSRCS += \
$(NULL)
endif
ifeq ($(OS_ARCH),WINNT)
OS_CXXFLAGS += -DNOMINMAX
endif
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -25,6 +25,10 @@ CPPSRCS = \
WMFUtils.cpp \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
OS_CXXFLAGS += -DNOMINMAX
endif
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -20,6 +20,8 @@ WIN_LIBS= \
---------------------------------------------------------------------- */
#define NOMINMAX 1
#include "plstr.h"
#include <windows.h>
#include <tchar.h>

Просмотреть файл

@ -10,7 +10,7 @@
#define FORCE_PR_LOG
#endif
#include <stdarg.h>
#include <cstdarg>
#include "prlog.h"
#ifdef ANDROID