Monday, January 14, 2013

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

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
     1.1 --- a/accessible/src/windows/ia2/Makefile.in      1.2 +++ b/accessible/src/windows/ia2/Makefile.in      1.3 @@ -34,16 +34,20 @@ EXPORTS = \      1.4    ia2AccessibleAction.h \      1.5    ia2AccessibleComponent.h \      1.6    ia2AccessibleEditableText.h \      1.7    ia2AccessibleHyperlink.h \      1.8    ia2AccessibleHypertext.h \      1.9    ia2AccessibleText.h \     1.10    $(NULL)     1.11       1.12 +# The midl generated code include Windows headers which defines min and max     1.13 +# macros which conflicts with std::min/max.  Suppress the macros:     1.14 +OS_CXXFLAGS += -DNOMINMAX     1.15 +     1.16  # we don't want the shared lib, but we want to force the creation of a static lib.     1.17  FORCE_STATIC_LIB = 1     1.18       1.19  include $(topsrcdir)/config/config.mk     1.20  include $(topsrcdir)/config/rules.mk     1.21       1.22  LOCAL_INCLUDES += \     1.23    -I$(srcdir) \ 
     2.1 --- a/accessible/src/windows/sdn/Makefile.in      2.2 +++ b/accessible/src/windows/sdn/Makefile.in      2.3 @@ -8,16 +8,19 @@ srcdir = @srcdir@      2.4  VPATH = @srcdir@      2.5        2.6  include $(DEPTH)/config/autoconf.mk      2.7        2.8  MODULE = accessibility      2.9  LIBRARY_NAME = accessibility_toolkit_sdn_s     2.10  EXPORT_LIBRARY = 1     2.11  LIBXUL_LIBRARY = 1     2.12 +# The midl generated code include Windows headers which defines min and max     2.13 +# macros which conflicts with std::min/max.  Suppress the macros:     2.14 +OS_CXXFLAGS += -DNOMINMAX     2.15       2.16  CPPSRCS += \     2.17    sdnAccessible.cpp \     2.18    $(NULL)     2.19       2.20  # we don't want the shared lib, but we want to force the creation of a static lib.     2.21  FORCE_STATIC_LIB = 1     2.22   
     3.1 --- a/accessible/src/windows/uia/Makefile.in      3.2 +++ b/accessible/src/windows/uia/Makefile.in      3.3 @@ -8,16 +8,19 @@ srcdir = @srcdir@      3.4  VPATH = @srcdir@      3.5        3.6  include $(DEPTH)/config/autoconf.mk      3.7        3.8  MODULE = accessibility      3.9  LIBRARY_NAME = accessibility_toolkit_uia_s     3.10  EXPORT_LIBRARY = ..     3.11  LIBXUL_LIBRARY = 1     3.12 +# The midl generated code include Windows headers which defines min and max     3.13 +# macros which conflicts with std::min/max.  Suppress the macros:     3.14 +OS_CXXFLAGS += -DNOMINMAX     3.15       3.16       3.17  CPPSRCS += \     3.18    uiaRawElmProvider.cpp \     3.19    $(NULL)     3.20       3.21  # we don't want the shared lib, but we want to force the creation of a static lib.     3.22  FORCE_STATIC_LIB = 1 
     4.1 --- a/config/gcc-stl-wrapper.template.h      4.2 +++ b/config/gcc-stl-wrapper.template.h      4.3 @@ -12,16 +12,21 @@      4.4  // compiling ObjC.      4.5  #if __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)      4.6  #  error "STL code can only be used with -fno-exceptions"      4.7  #endif      4.8        4.9  // Silence "warning: #include_next is a GCC extension"     4.10  #pragma GCC system_header     4.11       4.12 +#ifdef _WIN32     4.13 +// Suppress windef.h min and max macros - they make std::min/max not compile.     4.14 +#define NOMINMAX 1     4.15 +#endif     4.16 +     4.17  // mozalloc.h wants <new>; break the cycle by always explicitly     4.18  // including <new> here.  NB: this is a tad sneaky.  Sez the gcc docs:     4.19  //     4.20  //    `#include_next' does not distinguish between <file> and "file"     4.21  //    inclusion, nor does it check that the file you specify has the     4.22  //    same name as the current file. It simply looks for the file     4.23  //    named, starting with the directory in the search path after the     4.24  //    one where the current file was found. 
     5.1 --- a/config/msvc-stl-wrapper.template.h      5.2 +++ b/config/msvc-stl-wrapper.template.h      5.3 @@ -7,16 +7,19 @@      5.4        5.5  #ifndef mozilla_${HEADER}_h      5.6  #define mozilla_${HEADER}_h      5.7        5.8  #if _HAS_EXCEPTIONS      5.9  #  error "STL code can only be used with -fno-exceptions"     5.10  #endif     5.11       5.12 +// Suppress windef.h min and max macros - they make std::min/max not compile.     5.13 +#define NOMINMAX 1     5.14 +     5.15  // Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k     5.16  // CRT doesn't export std::_Throw().  So we define it.     5.17  #ifndef mozilla_Throw_h     5.18  #  include "mozilla/throw_msvc.h"     5.19  #endif     5.20       5.21  // Code might include <new> before other wrapped headers, but <new>     5.22  // includes <exception> and so we want to wrap it.  But mozalloc.h 
     6.1 --- a/content/media/webrtc/Makefile.in      6.2 +++ b/content/media/webrtc/Makefile.in      6.3 @@ -29,16 +29,20 @@ EXPORTS += \      6.4        6.5  CPPSRCS += \      6.6    MediaEngineWebRTC.cpp \      6.7    MediaEngineWebRTCVideo.cpp \      6.8    MediaEngineWebRTCAudio.cpp \      6.9    $(NULL)     6.10  endif     6.11       6.12 +ifeq ($(OS_ARCH),WINNT)     6.13 +OS_CXXFLAGS += -DNOMINMAX     6.14 +endif     6.15 +     6.16  FORCE_STATIC_LIB = 1     6.17       6.18  include $(topsrcdir)/config/rules.mk     6.19       6.20  ifdef MOZ_WEBRTC     6.21  LOCAL_INCLUDES += \     6.22    -I$(topsrcdir)/media/webrtc/trunk/src \     6.23    -I$(topsrcdir)/media/webrtc/signaling/src/common \ 
     7.1 --- a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp      7.2 +++ b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp      7.3 @@ -15,16 +15,18 @@ To Build This:      7.4        7.5  WIN_LIBS=                                       \      7.6          winspool.lib                           \      7.7          comctl32.lib                           \      7.8          comdlg32.lib      7.9       7.10  ---------------------------------------------------------------------- */     7.11       7.12 +#define NOMINMAX 1     7.13 +     7.14  #include "plstr.h"     7.15  #include <windows.h>     7.16  #include <tchar.h>     7.17       7.18  #include <unknwn.h>     7.19  #include <commdlg.h>     7.20       7.21  #include "nsIWebBrowserPrint.h" 
     8.1 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp      8.2 +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp      8.3 @@ -5,17 +5,17 @@      8.4   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */      8.5        8.6  #include "mozilla/Attributes.h"      8.7        8.8  #ifdef MOZ_LOGGING      8.9  #define FORCE_PR_LOG     8.10  #endif     8.11       8.12 -#include <stdarg.h>     8.13 +#include <cstdarg>     8.14       8.15  #include "prlog.h"     8.16  #ifdef ANDROID     8.17  #include <android/log.h>     8.18  #endif     8.19  #ifdef XP_WIN     8.20  #include <windows.h>     8.21  #endif 

Source: http://hg.mozilla.org/try/rev/5cb3e7564bdf

Opening ceremony London 2012 Google Fiber Olympics Schedule 2012 Olympic Medal Count 2012 Olympics 2012 Olympic Schedule 2012 NBC Olympics

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.