From d616a7ec4475c83f3d39b1673665386d6ccfaa27 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 2 Dec 2016 12:55:34 -0500 Subject: [PATCH] Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium --HG-- extra : rebase_source : 8c700498470b42279197f316d553154b1f2ed235 --- .../signaling/fuzztest/sdp_file_parser.cpp | 2 -- toolkit/xre/nsAppRunner.cpp | 2 +- .../libfuzzer/harness/LibFuzzerRegistry.cpp | 12 +++++------ xpcom/base/nscore.h | 20 ++++--------------- xpcom/build/xrecore.h | 10 +--------- xpcom/reflect/xptcall/xptcall.h | 3 ++- 6 files changed, 13 insertions(+), 36 deletions(-) diff --git a/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp b/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp index fef1ab224fb3..0b85ba0e6652 100644 --- a/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp +++ b/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp @@ -26,7 +26,6 @@ void CSFLog(CSFLogLevel priority, const char* sourceFile, int sourceLine, const va_end(ap); } -extern "C" { void NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr, const char* aFile, int32_t aLine) @@ -34,7 +33,6 @@ void NS_DebugBreak(uint32_t aSeverity, fprintf(stderr, "NS_DebugBreak: %u %s %s %s %u", aSeverity, aStr, aExpr, aFile, aLine); } -} // end extern "C". namespace mozilla { diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index bed59170749c..5db73bf9f2b7 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -272,7 +272,7 @@ 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 diff --git a/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp b/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp index 5390c91c2a4b..bab90c5a4e2d 100644 --- a/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp +++ b/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp @@ -5,13 +5,11 @@ #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 { diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index 356adba1def0..3db44750c694 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -175,23 +175,11 @@ * 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 /* diff --git a/xpcom/build/xrecore.h b/xpcom/build/xrecore.h index 9749a8e9066c..3d5a936e92cd 100644 --- a/xpcom/build/xrecore.h +++ b/xpcom/build/xrecore.h @@ -12,14 +12,6 @@ /** * 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__ diff --git a/xpcom/reflect/xptcall/xptcall.h b/xpcom/reflect/xptcall/xptcall.h index 1f2367b5db7c..5a1b7bb6050d 100644 --- a/xpcom/reflect/xptcall/xptcall.h +++ b/xpcom/reflect/xptcall/xptcall.h @@ -186,7 +186,8 @@ NS_DestroyXPTCallStub(nsISomeInterface* aStub); 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);