Bug 1463637: Remove mozilla-config.h hacks for Hunspell extra includes. r=ted
authorKris Maglione <maglione.k@gmail.com>
Tue, 22 May 2018 20:36:39 -0700
changeset 420058 79a77332a9e515bfae5e1807b5c57be7cec7c83a
parent 420057 43a358272d5e8ac3080e2afb192cfde755dc4e56
child 420059 2b4d1f1c2e30ff501d267926b3d48def81b7179a
push id34060
push usercsabou@mozilla.com
push dateSun, 27 May 2018 13:06:48 +0000
treeherdermozilla-central@6b9076ac236c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1463637
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1463637: Remove mozilla-config.h hacks for Hunspell extra includes. r=ted MozReview-Commit-ID: 2yBlykhQsyV
build/templates.mozbuild
extensions/spellcheck/hunspell/glue/common.mozbuild
extensions/spellcheck/hunspell/glue/hunspell_alloc_hooks.h
extensions/spellcheck/hunspell/glue/hunspell_fopen_hooks.h
extensions/spellcheck/hunspell/glue/moz.build
extensions/spellcheck/hunspell/src/moz.build
mozilla-config.h.in
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -125,10 +125,20 @@ def DisableStlWrapping():
 @template
 def NoVisibilityFlags():
     COMPILE_FLAGS['VISIBILITY'] = []
 
 @template
 def AllowCompilerWarnings():
     COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = []
 
+@template
+def ForceInclude(*headers):
+    """Force includes a set of header files in C++ compilations"""
+    if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
+        include_flag = '-FI'
+    else:
+        include_flag = '-include'
+    for header in headers:
+        CXXFLAGS += [include_flag, header]
+
 include('gecko_templates.mozbuild')
 include('test_templates.mozbuild')
new file mode 100644
--- /dev/null
+++ b/extensions/spellcheck/hunspell/glue/common.mozbuild
@@ -0,0 +1,9 @@
+# -*- Mode: python; 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/.
+
+@template
+def HunspellIncludes():
+    ForceInclude('hunspell_alloc_hooks.h', 'hunspell_fopen_hooks.h')
--- a/extensions/spellcheck/hunspell/glue/hunspell_alloc_hooks.h
+++ b/extensions/spellcheck/hunspell/glue/hunspell_alloc_hooks.h
@@ -34,19 +34,16 @@
 #ifndef alloc_hooks_h__
 #define alloc_hooks_h__
 
 /**
  * This file is force-included in hunspell code.  Its purpose is to add memory
  * reporting to hunspell without modifying its code, in order to ease future
  * upgrades.
  *
- * This file is force-included through mozilla-config.h which is generated
- * during the configure step.
- *
  * Currently, the memory allocated using operator new/new[] is not being
  * tracked, but that's OK, since almost all of the memory used by Hunspell is
  * allocated using C memory allocation functions.
  */
 
 #include "mozilla/mozalloc.h"
 #include "mozHunspellAllocator.h"
 
--- a/extensions/spellcheck/hunspell/glue/hunspell_fopen_hooks.h
+++ b/extensions/spellcheck/hunspell/glue/hunspell_fopen_hooks.h
@@ -4,19 +4,16 @@
 
 #ifndef fopen_hooks_h__
 #define fopen_hooks_h__
 
 /**
  * This file is force-included in hunspell code. Its purpose is to add
  * readahead to fopen() calls in hunspell without modifying its code, in order
  * to ease future upgrades.
- *
- * This file is force-included through mozilla-config.h which is generated
- * during the configure step.
  */
 
 #include "mozilla/FileUtils.h"
 #include <stdio.h>
 #include <string.h>
 
 #if defined(XP_WIN)
 #include "nsNativeCharsetUtils.h"
--- a/extensions/spellcheck/hunspell/glue/moz.build
+++ b/extensions/spellcheck/hunspell/glue/moz.build
@@ -15,21 +15,20 @@ FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../src',
     '/dom/base',
     '/extensions/spellcheck/src',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
+include('common.mozbuild')
+
+HunspellIncludes()
 
 IPDL_SOURCES = [
     'PRemoteSpellcheckEngine.ipdl',
 ]
 
 EXPORTS.mozilla += [
      'RemoteSpellCheckEngineChild.h',
      'RemoteSpellCheckEngineParent.h',
 ]
-
-# This variable is referenced in mozilla-config.h.in.  Make sure to change
-# that file too if you need to change this variable.
-DEFINES['HUNSPELL_STATIC'] = True
--- a/extensions/spellcheck/hunspell/src/moz.build
+++ b/extensions/spellcheck/hunspell/src/moz.build
@@ -10,27 +10,26 @@ UNIFIED_SOURCES += [
     'csutil.cxx',
     'hashmgr.cxx',
     'hunspell.cxx',
     'phonet.cxx',
     'replist.cxx',
     'suggestmgr.cxx',
 ]
 
-# This variable is referenced in mozilla-config.h.in.  Make sure to change
-# that file too if you need to change this variable.
-DEFINES['HUNSPELL_STATIC'] = True
-
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../glue',
 ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 AllowCompilerWarnings()
 
 include('/ipc/chromium/chromium-config.mozbuild')
+include('../glue/common.mozbuild')
+
+HunspellIncludes()
 
 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
     CXXFLAGS += [
         '-Wno-implicit-fallthrough',
     ]
--- a/mozilla-config.h.in
+++ b/mozilla-config.h.in
@@ -33,27 +33,16 @@
 #define __STDC_FORMAT_MACROS
 #endif
 
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
 
 /*
- * Force-include hunspell_alloc_hooks.h and hunspell_fopen_hooks.h for hunspell,
- * so that we don't need to modify them directly.
- *
- * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/moz.build
- */
-#if defined(HUNSPELL_STATIC)
-#include "hunspell_alloc_hooks.h"
-#include "hunspell_fopen_hooks.h"
-#endif
-
-/*
  * Force-include sdkdecls.h for building the chromium sandbox code.
  *
  * CHROMIUM_SANDBOX_BUILD is defined in security/sandbox/moz.build.
  * Note that this include path relies on the LOCAL_INCLUDES in that file.
  */
 #if defined(CHROMIUM_SANDBOX_BUILD) && defined(XP_WIN)
 #include "base/win/sdkdecls.h"