Bug 936912 - Build xpcom in unified mode; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 18 Nov 2013 21:34:00 -0500
changeset 165315 0d469a8e2208b95097308da1128d0ec59ff63f78
parent 165314 f12f7257b1c61f47dd82e1b763b445743d7f6c3b
child 165316 8dea4d73860a82cc3e8b5a77d0fbb530dbf5a126
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs936912
milestone28.0a1
Bug 936912 - Build xpcom in unified mode; r=froydnj
xpcom/base/moz.build
xpcom/base/nsGZFileWriter.h
xpcom/build/moz.build
xpcom/components/moz.build
xpcom/ds/moz.build
xpcom/glue/moz.build
xpcom/glue/nsQuickSort.cpp
xpcom/io/moz.build
xpcom/io/nsAppFileLocationProvider.h
xpcom/io/nsInputStreamTee.cpp
xpcom/io/nsPipe3.cpp
xpcom/io/nsStorageStream.cpp
xpcom/reflect/xptinfo/src/moz.build
xpcom/sample/moz.build
xpcom/sample/nsSample.h
xpcom/string/src/moz.build
xpcom/threads/moz.build
xpcom/threads/nsEventQueue.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsThreadPool.cpp
xpcom/typelib/xpt/src/moz.build
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -81,17 +81,17 @@ EXPORTS.mozilla += [
     'VisualEventTracer.h',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS.mozilla += [
         'WindowsVersion.h',
     ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'AvailableMemoryTracker.cpp',
     'ClearOnShutdown.cpp',
     'CycleCollectedJSRuntime.cpp',
     'Debug.cpp',
     'nsConsoleMessage.cpp',
     'nsConsoleService.cpp',
     'nsCycleCollector.cpp',
     'nsDebugImpl.cpp',
@@ -115,17 +115,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
     SOURCES += [
         'nsMacUtilsImpl.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     SOURCES += [
         'nsCrashOnException.cpp',
     ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsErrorAssertsC.c',
 ]
 
 
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/xpcom/base/nsGZFileWriter.h
+++ b/xpcom/base/nsGZFileWriter.h
@@ -1,14 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef nsGZFileWriter_h
+#define nsGZFileWriter_h
+
 #include "nsIGZFileWriter.h"
 #include "zlib.h"
 
 /**
  * A simple class for writing .gz files.
  */
 class nsGZFileWriter : public nsIGZFileWriter
 {
@@ -34,8 +37,10 @@ public:
     return nsIGZFileWriter::Write(aStr, aLen);
   }
 
 private:
   bool mInitialized;
   bool mFinished;
   gzFile mGZFile;
 };
+
+#endif
--- a/xpcom/build/moz.build
+++ b/xpcom/build/moz.build
@@ -39,20 +39,20 @@ elif CONFIG['OS_ARCH'] == 'Darwin' and C
         'PoisonIOInterposerBase.cpp',
         'PoisonIOInterposerMac.cpp',
     ]
 else:
     SOURCES += ['PoisonIOInterposerStub.cpp']
 
 include('../glue/objs.mozbuild')
 
-SOURCES += xpcom_gluens_src_cppsrcs
-SOURCES += xpcom_glue_src_cppsrcs
+UNIFIED_SOURCES += xpcom_gluens_src_cppsrcs
+UNIFIED_SOURCES += xpcom_glue_src_cppsrcs
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'FileLocation.cpp',
     'FrozenFunctions.cpp',
     'LateWriteChecks.cpp',
     'nsXPComInit.cpp',
     'nsXPCOMStrings.cpp',
     'Omnijar.cpp',
     'Services.cpp',
 ]
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
@@ -21,18 +21,23 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla += [
     'Module.h',
     'ModuleLoader.h',
     'ModuleUtils.h',
 ]
 
+# These two files cannot be built in unified mode because they use the
+# PL_ARENA_CONST_ALIGN_MASK macro with plarena.h.
 SOURCES += [
-    'ManifestParser.cpp',
     'nsCategoryManager.cpp',
     'nsComponentManager.cpp',
+]
+
+UNIFIED_SOURCES += [
+    'ManifestParser.cpp',
     'nsNativeComponentLoader.cpp',
 ]
 
 MSVC_ENABLE_PGO = True
 
 FINAL_LIBRARY = 'xpcom_core'
--- a/xpcom/ds/moz.build
+++ b/xpcom/ds/moz.build
@@ -65,37 +65,42 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla += [
     'CharTokenizer.h',
     'StringBuilder.h',
     'TimeStamp.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsArray.cpp',
     'nsAtomService.cpp',
     'nsAtomTable.cpp',
     'nsCRT.cpp',
     'nsHashPropertyBag.cpp',
     'nsHashtable.cpp',
     'nsINIParserImpl.cpp',
     'nsObserverList.cpp',
     'nsObserverService.cpp',
-    'nsPersistentProperties.cpp',
     'nsProperties.cpp',
-    'nsStaticNameTable.cpp',
     'nsStringEnumerator.cpp',
     'nsSupportsArray.cpp',
     'nsSupportsArrayEnumerator.cpp',
     'nsSupportsPrimitives.cpp',
     'nsVariant.cpp',
     'TimeStamp.cpp',
 ]
 
+# These two files cannot be built in unified mode because they use the
+# PL_ARENA_CONST_ALIGN_MASK macro with plarena.h.
+SOURCES += [
+    'nsPersistentProperties.cpp',
+    'nsStaticNameTable.cpp',
+]
+
 if CONFIG['OS_ARCH'] == 'WINNT':
     SOURCES += [
         'TimeStamp_windows.cpp',
     ]
 elif CONFIG['HAVE_CLOCK_MONOTONIC']:
     SOURCES += [
         'TimeStamp_posix.cpp',
     ]
--- a/xpcom/glue/moz.build
+++ b/xpcom/glue/moz.build
@@ -82,20 +82,20 @@ EXPORTS.mozilla += [
 ]
 
 EXPORTS.mozilla.threads += [
     'nsThreadIDs.h',
 ]
 
 include('objs.mozbuild')
 
-SOURCES += xpcom_gluens_src_cppsrcs
-SOURCES += xpcom_glue_src_cppsrcs
+UNIFIED_SOURCES += xpcom_gluens_src_cppsrcs
+UNIFIED_SOURCES += xpcom_glue_src_cppsrcs
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'GenericModule.cpp',
     'nsStringAPI.cpp',
 ]
 
 LIBRARY_NAME = 'xpcomglue_s'
 
 SDK_LIBRARY = [
     "%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_s', CONFIG['LIB_SUFFIX']),
--- a/xpcom/glue/nsQuickSort.cpp
+++ b/xpcom/glue/nsQuickSort.cpp
@@ -174,8 +174,14 @@ loop:	SWAPINIT(a, es);
 		a = pn - r;
 		n = r / es;
 		goto loop;
 	}
 /*		NS_QuickSort(pn - r, r / es, es, cmp, data);*/
 }
 
 }
+
+#undef INLINE
+#undef swapcode
+#undef SWAPINIT
+#undef swap
+#undef vecswap
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -85,17 +85,17 @@ EXPORTS += [
     'nsWildCard.h',
     'SpecialSystemDirectory.h',
 ]
 
 EXPORTS.mozilla += [
     'Base64.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'Base64.cpp',
     'nsAnonymousTemporaryFile.cpp',
     'nsAppFileLocationProvider.cpp',
     'nsBinaryStream.cpp',
     'nsDirectoryService.cpp',
     'nsEscape.cpp',
     'nsInputStreamTee.cpp',
     'nsIOUtil.cpp',
--- a/xpcom/io/nsAppFileLocationProvider.h
+++ b/xpcom/io/nsAppFileLocationProvider.h
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef nsAppFileLocationProvider_h
+#define nsAppFileLocationProvider_h
+
 #include "nsIDirectoryService.h"
 #include "nsIFile.h"
 #include "mozilla/Attributes.h"
 
 class nsIFile;
 
 //*****************************************************************************
 // class nsAppFileLocationProvider
@@ -40,8 +43,10 @@ protected:
                                                   bool aLocal = false);
 
 #if defined(MOZ_WIDGET_COCOA)
    static bool          IsOSXLeopard();
 #endif
 
    nsCOMPtr<nsIFile> mMozBinDirectory;
 };
+
+#endif
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -13,16 +13,19 @@
 #include "nsIOutputStream.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsIEventTarget.h"
 #include "nsThreadUtils.h"
 
 using namespace mozilla;
 
+#ifdef LOG
+#undef LOG
+#endif
 #ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetTeeLog()
 {
     static PRLogModuleInfo *sLog;
     if (!sLog)
         sLog = PR_NewLogModule("nsInputStreamTee");
     return sLog;
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -16,16 +16,19 @@
 #include "nsIClassInfoImpl.h"
 #include "nsAlgorithm.h"
 #include "nsMemory.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 
 using namespace mozilla;
 
+#ifdef LOG
+#undef LOG
+#endif
 #if defined(PR_LOGGING)
 //
 // set NSPR_LOG_MODULES=nsPipe:5
 //
 static PRLogModuleInfo *
 GetPipeLog()
 {
   static PRLogModuleInfo *sLog;
--- a/xpcom/io/nsStorageStream.cpp
+++ b/xpcom/io/nsStorageStream.cpp
@@ -40,16 +40,19 @@ static PRLogModuleInfo*
 GetStorageStreamLog()
 {
     static PRLogModuleInfo *sLog;
     if (!sLog)
         sLog = PR_NewLogModule("nsStorageStream");
     return sLog;
 }
 #endif
+#ifdef LOG
+#undef LOG
+#endif
 #define LOG(args) PR_LOG(GetStorageStreamLog(), PR_LOG_DEBUG, args)
 
 nsStorageStream::nsStorageStream()
     : mSegmentedBuffer(0), mSegmentSize(0), mWriteInProgress(false),
       mLastSegmentNum(-1), mWriteCursor(0), mSegmentEnd(0), mLogicalLength(0)
 {
     LOG(("Creating nsStorageStream [%p].\n", this));
 }
--- a/xpcom/reflect/xptinfo/src/moz.build
+++ b/xpcom/reflect/xptinfo/src/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'xptiInterfaceInfo.cpp',
     'xptiInterfaceInfoManager.cpp',
     'xptiTypelibGuts.cpp',
     'xptiWorkingSet.cpp',
 ]
 
 MSVC_ENABLE_PGO = True
 
--- a/xpcom/sample/moz.build
+++ b/xpcom/sample/moz.build
@@ -12,17 +12,17 @@ TEST_TOOL_DIRS += ['program']
 # on these files to generate C++ headers and .xpt typelib files.
 XPIDL_SOURCES += ['nsISample.idl']
 
 # XPIDL_MODULE specifies where header files from this Makefile are installed,
 # i.e. dist/include/xpcomsample
 XPIDL_MODULE = 'xpcomsample'
 
 # CPP_SOURCES specifies C++ files to be built into a library.
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsSample.cpp',
     'nsSampleModule.cpp',
 ]
 
 # EXTRA_COMPONENTS installs components written JavaScript to
 # dist/bin/components
 EXTRA_COMPONENTS += [
     'nsSample.js',
--- a/xpcom/sample/nsSample.h
+++ b/xpcom/sample/nsSample.h
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef nsSample_h
+#define nsSample_h
+
 /**
  * A sample of XPConnect. This file is the header of an implementation
  * nsSample of the nsISample interface.
  *
  */
 
 #include "nsISample.h"
 #include "mozilla/Attributes.h"
@@ -91,8 +94,10 @@ public:
      */
     /* NS_IMETHOD Poke(const char* aValue); */
 
 private:
     ~nsSampleImpl();
 
     char* mValue;
 };
+
+#endif
--- a/xpcom/string/src/moz.build
+++ b/xpcom/string/src/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsDependentString.cpp',
     'nsDependentSubstring.cpp',
     'nsPromiseFlatString.cpp',
     'nsReadableUtils.cpp',
     'nsString.cpp',
     'nsStringComparator.cpp',
     'nsStringObsolete.cpp',
     'nsSubstring.cpp',
--- a/xpcom/threads/moz.build
+++ b/xpcom/threads/moz.build
@@ -28,17 +28,17 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla += [
     'HangMonitor.h',
     'LazyIdleThread.h',
     'SyncRunnable.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'HangMonitor.cpp',
     'LazyIdleThread.cpp',
     'nsEnvironment.cpp',
     'nsEventQueue.cpp',
     'nsMemoryPressure.cpp',
     'nsProcessCommon.cpp',
     'nsThread.cpp',
     'nsThreadManager.cpp',
--- a/xpcom/threads/nsEventQueue.cpp
+++ b/xpcom/threads/nsEventQueue.cpp
@@ -16,16 +16,19 @@ static PRLogModuleInfo *
 GetLog()
 {
   static PRLogModuleInfo *sLog;
   if (!sLog)
     sLog = PR_NewLogModule("nsEventQueue");
   return sLog;
 }
 #endif
+#ifdef LOG
+#undef LOG
+#endif
 #define LOG(args) PR_LOG(GetLog(), PR_LOG_DEBUG, args)
 
 nsEventQueue::nsEventQueue()
   : mReentrantMonitor("nsEventQueue.mReentrantMonitor")
   , mHead(nullptr)
   , mTail(nullptr)
   , mOffsetHead(0)
   , mOffsetTail(0)
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -46,16 +46,19 @@ static PRLogModuleInfo *
 GetThreadLog()
 {
   static PRLogModuleInfo *sLog;
   if (!sLog)
     sLog = PR_NewLogModule("nsThread");
   return sLog;
 }
 #endif
+#ifdef LOG
+#undef LOG
+#endif
 #define LOG(args) PR_LOG(GetThreadLog(), PR_LOG_DEBUG, args)
 
 NS_DECL_CI_INTERFACE_GETTER(nsThread)
 
 nsIThreadObserver* nsThread::sMainThreadObserver = nullptr;
 
 //-----------------------------------------------------------------------------
 // Because we do not have our own nsIFactory, we have to implement nsIClassInfo
--- a/xpcom/threads/nsThreadPool.cpp
+++ b/xpcom/threads/nsThreadPool.cpp
@@ -20,16 +20,19 @@ static PRLogModuleInfo *
 GetThreadPoolLog()
 {
   static PRLogModuleInfo *sLog;
   if (!sLog)
     sLog = PR_NewLogModule("nsThreadPool");
   return sLog;
 }
 #endif
+#ifdef LOG
+#undef LOG
+#endif
 #define LOG(args) PR_LOG(GetThreadPoolLog(), PR_LOG_DEBUG, args)
 
 // DESIGN:
 //  o  Allocate anonymous threads.
 //  o  Use nsThreadPool::Run as the main routine for each thread.
 //  o  Each thread waits on the event queue's monitor, checking for
 //     pending events and rescheduling itself as an idle thread.
 
--- a/xpcom/typelib/xpt/src/moz.build
+++ b/xpcom/typelib/xpt/src/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 LIBRARY_NAME = 'xpt'
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'xpt_arena.c',
     'xpt_struct.c',
     'xpt_xdr.c',
 ]
 
 FINAL_LIBRARY = 'xpcom_core'