Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium draft
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 02 Dec 2016 12:55:34 -0500
changeset 463417 4f606db695ed9e286822bab71ea3c519d38af90e
parent 460834 5ede99e20d917eb22e8907046f4c7830f702147c
child 542665 563eca126a6b6830f6b80d4edf69c7bcd47a461a
push id42052
push userbmo:mh+mozilla@glandium.org
push dateThu, 19 Jan 2017 01:32:56 +0000
reviewersglandium
bugs1306329
milestone53.0a1
Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium
toolkit/xre/nsAppRunner.cpp
tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
xpcom/base/nscore.h
xpcom/build/xrecore.h
xpcom/reflect/xptcall/xptcall.h
--- 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,27 @@
 #else
 # define MOZ_DEPRECATED
 #endif
 
 /**
  * Import/Export macros for XPCOM APIs
  */
 
+#define EXPORT_XPCOM_API(type) type
+#define IMPORT_XPCOM_API(type) type
+#define GLUE_XPCOM_API(type) type
+
 #ifdef __cplusplus
 #define NS_EXTERN_C extern "C"
 #else
 #define NS_EXTERN_C
 #endif
 
-#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) NS_EXTERN_C 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___ */