Bug 981353 - CppEclipse - Fix nspr indexer errors. r=botond
authorBenoit Girard <b56girard@gmail.com>
Mon, 10 Mar 2014 13:37:34 -0400
changeset 172867 5f3a63ff170d31ad234609ee6bddeca2ed6491c2
parent 172866 aae54a60278db44e2021edf59cd6e45320143c30
child 172868 5fbf1c06ca9beed3f41a632cfe7010cd9f6e70bd
push id40843
push userb56girard@gmail.com
push dateMon, 10 Mar 2014 22:03:12 +0000
treeherdermozilla-inbound@6e7f5c8e3e83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs981353
milestone30.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 981353 - CppEclipse - Fix nspr indexer errors. r=botond
python/mozbuild/mozbuild/backend/cpp_eclipse.py
--- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py
+++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py
@@ -91,22 +91,32 @@ class CppEclipseBackend(CommonBackend):
         formatter_prefs_path = os.path.join(settings_dir, 'org.eclipse.cdt.core.prefs')
         with open(formatter_prefs_path, 'wb') as fh:
             fh.write(FORMATTER_SETTINGS);
 
         editor_prefs_path = os.path.join(workspace_settings_dir, "org.eclipse.ui.editors.prefs");
         with open(editor_prefs_path, 'wb') as fh:
             fh.write(EDITOR_SETTINGS);
 
+    def _define_entry(self, name, value):
+        define = ET.Element('entry')
+        define.set('kind', 'macro')
+        define.set('name', name)
+        define.set('value', value)
+        return ET.tostring(define)
+
     def _write_language_settings(self, fh):
         settings = LANGUAGE_SETTINGS_TEMPLATE
 
         settings = settings.replace('@GLOBAL_INCLUDE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include'))
+        settings = settings.replace('@NSPR_INCLUDE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include/nspr'))
         settings = settings.replace('@IPDL_INCLUDE_PATH@', os.path.join(self.environment.topobjdir, 'ipc/ipdl/_ipdlheaders'))
         settings = settings.replace('@PREINCLUDE_FILE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include/mozilla-config.h'))
+        settings = settings.replace('@DEFINE_MOZILLA_INTERNAL_API@', self._define_entry('MOZILLA_INTERNAL_API', '1'))
+        settings = settings.replace('@DEFINE_MDCPUCFG@', self._define_entry('MDCPUCFG', self.environment.substs['TARGET_NSPR_MDCPUCFG']))
 
         fh.write(settings)
 
     def _write_launch_files(self, launch_dir):
         main_gecko_launch = os.path.join(launch_dir, 'gecko.launch')
         with open(main_gecko_launch, 'wb') as fh:
             bin_dir = os.path.join(self.environment.topobjdir, 'dist')
 
@@ -275,29 +285,33 @@ LANGUAGE_SETTINGS_TEMPLATE = """<?xml ve
         <configuration id="0.1674256904" name="Default">
                 <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
                         <provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true" store-entries-with-project="true">
                                 <language id="org.eclipse.cdt.core.g++">
                                         <resource project-relative-path="">
                                                 <entry kind="includePath" name="@GLOBAL_INCLUDE_PATH@">
                                                         <flag value="LOCAL"/>
                                                 </entry>
+                                                <entry kind="includePath" name="@NSPR_INCLUDE_PATH@">
+                                                        <flag value="LOCAL"/>
+                                                </entry>
                                                 <entry kind="includePath" name="@IPDL_INCLUDE_PATH@">
                                                         <flag value="LOCAL"/>
                                                 </entry>
                                                 <entry kind="includeFile" name="@PREINCLUDE_FILE_PATH@">
                                                         <flag value="LOCAL"/>
                                                 </entry>
                                                 <!--
                                                   Because of https://developer.mozilla.org/en-US/docs/Eclipse_CDT#Headers_are_only_parsed_once
                                                   we need to make sure headers are parsed with MOZILLA_INTERNAL_API to make sure
                                                   the indexer gets the version that is used in most of the true. This means that
                                                   MOZILLA_EXTERNAL_API code will suffer.
                                                 -->
-                                                <entry kind="macro" name="MOZILLA_INTERNAL_API" value="1"/>
+                                                @DEFINE_MOZILLA_INTERNAL_API@
+                                                @DEFINE_MDCPUCFG@
                                         </resource>
                                 </language>
                         </provider>
                         <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-859273372804152468" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot; -std=c++11" prefer-non-shared="true" store-entries-with-project="true">
                              <language-scope id="org.eclipse.cdt.core.gcc"/>
                              <language-scope id="org.eclipse.cdt.core.g++"/>
                         </provider>
                         <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>