Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium
☠☠ backed out by 93ffc3c44ee3 ☠ ☠
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 02 Dec 2016 12:55:34 -0500
changeset 374832 1c2f51ce3faff9c2ecd9d6c09ac49de975946185
parent 374831 6bb17b9a62d8ebeeaed80e87c14449b1d7dc6bb6
child 374833 77c56a2901b317ab2949c75e064ae8a8b998cd7f
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1306329
milestone53.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 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium
media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
toolkit/xre/nsAppRunner.cpp
tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
xpcom/base/nscore.h
xpcom/build/xrecore.h
xpcom/reflect/xptcall/xptcall.h
--- a/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
+++ b/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
@@ -21,25 +21,23 @@ void CSFLog(CSFLogLevel priority, const 
   va_start(ap, format);
 
   printf("%s\n:", tag);
   vprintf(format, ap);
 
   va_end(ap);
 }
 
-extern "C" {
 void NS_DebugBreak(uint32_t aSeverity,
                    const char* aStr, const char* aExpr,
                    const char* aFile, int32_t aLine)
 {
   fprintf(stderr, "NS_DebugBreak: %u %s %s %s %u", aSeverity, aStr, aExpr,
           aFile, aLine);
 }
-} // end extern "C".
 
 namespace mozilla {
 
 enum class LogLevel {
 
 };
 
 namespace detail {
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -267,17 +267,17 @@ extern "C" MFBT_API bool IsSignalHandlin
 
 #ifdef LIBFUZZER
 #include "LibFuzzerRunner.h"
 
 namespace mozilla {
 LibFuzzerRunner* libFuzzerRunner = 0;
 } // namespace mozilla
 
-extern "C" MOZ_EXPORT void XRE_LibFuzzerSetMain(int argc, char** argv, LibFuzzerMain main) {
+void XRE_LibFuzzerSetMain(int argc, char** argv, LibFuzzerMain main) {
   mozilla::libFuzzerRunner->setParams(argc, argv, main);
 }
 #endif
 
 namespace mozilla {
 int (*RunGTest)(int*, char**) = 0;
 } // namespace mozilla
 
--- a/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
+++ b/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
@@ -1,22 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * * 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/. */
 
 #include "LibFuzzerRegistry.h"
 
-extern "C" {
-    void MOZ_EXPORT XRE_LibFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, LibFuzzerTestingFunc* testingFunc) {
-        std::string moduleNameStr(moduleName);
-        mozilla::LibFuzzerFunctions funcs = mozilla::LibFuzzerRegistry::getInstance().getModuleFunctions(moduleNameStr);
-        *initFunc = funcs.first;
-        *testingFunc = funcs.second;
-    }
+void XRE_LibFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, LibFuzzerTestingFunc* testingFunc) {
+    std::string moduleNameStr(moduleName);
+    mozilla::LibFuzzerFunctions funcs = mozilla::LibFuzzerRegistry::getInstance().getModuleFunctions(moduleNameStr);
+    *initFunc = funcs.first;
+    *testingFunc = funcs.second;
 }
 
 namespace mozilla {
 
 LibFuzzerRegistry& LibFuzzerRegistry::getInstance() {
     static LibFuzzerRegistry instance;
     return instance;
 }
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -170,33 +170,21 @@
 #else
 # define MOZ_DEPRECATED
 #endif
 
 /**
  * Import/Export macros for XPCOM APIs
  */
 
-#ifdef __cplusplus
-#define NS_EXTERN_C extern "C"
-#else
-#define NS_EXTERN_C
-#endif
+#define EXPORT_XPCOM_API(type) type
+#define IMPORT_XPCOM_API(type) type
+#define GLUE_XPCOM_API(type) type
 
-#define EXPORT_XPCOM_API(type) NS_EXTERN_C NS_EXPORT type NS_FROZENCALL
-#define IMPORT_XPCOM_API(type) NS_EXTERN_C NS_IMPORT type NS_FROZENCALL
-#define GLUE_XPCOM_API(type) NS_EXTERN_C NS_HIDDEN_(type) NS_FROZENCALL
-
-#ifdef IMPL_LIBXUL
-#define XPCOM_API(type) EXPORT_XPCOM_API(type)
-#elif defined(XPCOM_GLUE)
-#define XPCOM_API(type) GLUE_XPCOM_API(type)
-#else
-#define XPCOM_API(type) IMPORT_XPCOM_API(type)
-#endif
+#define XPCOM_API(type) type
 
 #ifdef MOZILLA_INTERNAL_API
    /*
      The frozen string API has different definitions of nsAC?String
      classes than the internal API. On systems that explicitly declare
      dllexport symbols this is not a problem, but on ELF systems
      internal symbols can accidentally "shine through"; we rename the
      internal classes to avoid symbol conflicts.
--- a/xpcom/build/xrecore.h
+++ b/xpcom/build/xrecore.h
@@ -7,19 +7,11 @@
 #ifndef xrecore_h__
 #define xrecore_h__
 
 #include "nscore.h"
 
 /**
  * Import/export macros for libXUL APIs.
  */
-#ifdef XPCOM_GLUE
-#define XRE_API(type, name, params) \
-  typedef type (NS_FROZENCALL * name##Type) params; \
-  extern name##Type name NS_HIDDEN;
-#elif defined(IMPL_LIBXUL)
-#define XRE_API(type, name, params) EXPORT_XPCOM_API(type) name params;
-#else
-#define XRE_API(type, name, params) IMPORT_XPCOM_API(type) name params;
-#endif
+#define XRE_API(type, name, params) type name params;
 
 #endif // xrecore_h__
--- a/xpcom/reflect/xptcall/xptcall.h
+++ b/xpcom/reflect/xptcall/xptcall.h
@@ -181,13 +181,14 @@ XPCOM_API(void)
 NS_DestroyXPTCallStub(nsISomeInterface* aStub);
 
 /**
  * Measures the size of an XPTCall stub previously created with NS_GetXPTCallStub.
  */
 XPCOM_API(size_t)
 NS_SizeOfIncludingThisXPTCallStub(const nsISomeInterface* aStub, mozilla::MallocSizeOf aMallocSizeOf);
 
-XPCOM_API(nsresult)
+// this is extern "C" because on some platforms it is implemented in assembly
+extern "C" nsresult
 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant* params);
 
 #endif /* xptcall_h___ */