Bug 1498392 - Switch from __FUNCTION__ to the standard __func__ to unbreak JsAccount on clang-cl builds. r=jorgk
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Thu, 11 Oct 2018 16:11:06 +0100
changeset 33352 e4fff573e9c7593cfeec20903728590d37443c7b
parent 33351 5333ee90a410dedf329fe207fff3b6af98f370d2
child 33353 056b4d7d3d6b1e2689c028805757b637bf8f0bb3
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1498392
Bug 1498392 - Switch from __FUNCTION__ to the standard __func__ to unbreak JsAccount on clang-cl builds. r=jorgk
mailnews/jsaccount/public/msgIDelegateList.idl
mailnews/jsaccount/src/DelegateList.cpp
mailnews/jsaccount/src/DelegateList.h
mailnews/jsaccount/src/JaAbDirectory.cpp
mailnews/jsaccount/src/JaCompose.cpp
mailnews/jsaccount/src/JaIncomingServer.cpp
mailnews/jsaccount/src/JaMsgFolder.cpp
mailnews/jsaccount/src/JaSend.cpp
mailnews/jsaccount/src/JaUrl.cpp
--- a/mailnews/jsaccount/public/msgIDelegateList.idl
+++ b/mailnews/jsaccount/public/msgIDelegateList.idl
@@ -10,10 +10,10 @@
  * This interface provides a list of methods that should be delegated to
  * a JsObject rather than a C++ XPCOM base object in JsAccount classes.
  */
 
 [scriptable, builtinclass, uuid(627D3A34-F8A3-40eb-91FE-E413D6638D27)]
 interface msgIDelegateList : nsISupports
 {
   /// Method name to delegate to JavaScript.
-  void add(in string aMethod);
+  void add(in ACString aMethod);
 };
--- a/mailnews/jsaccount/src/DelegateList.cpp
+++ b/mailnews/jsaccount/src/DelegateList.cpp
@@ -10,24 +10,16 @@
 // of methods to be overridden by JS implementations, in a way that can
 // be stored and manipulated in JS, but used efficiently in C++.
 
 namespace mozilla {
 namespace mailnews {
 
 NS_IMPL_ISUPPORTS(DelegateList, msgIDelegateList)
 
-NS_IMETHODIMP DelegateList::Add(const char *aMethodName)
+NS_IMETHODIMP DelegateList::Add(const nsACString& aMethodName)
 {
-  // __FUNCTION__ is the undecorated function name in gcc, but decorated in
-  // Windows. __func__ will resolve this when supported in VS 2015.
-  nsCString prettyFunction;
-#if defined (_MSC_VER)
-  prettyFunction.Append(mPrefix);
-#endif
-  prettyFunction.Append(nsDependentCString(aMethodName));
-
-  mMethods.Put(prettyFunction, true);
+  mMethods.Put(aMethodName, true);
   return NS_OK;
 }
 
 } // namespace mailnews
 } // namespace mozilla
--- a/mailnews/jsaccount/src/DelegateList.h
+++ b/mailnews/jsaccount/src/DelegateList.h
@@ -16,37 +16,34 @@ namespace mozilla {
 namespace mailnews {
 
 // This class provides a list of method names to delegate to another object.
 class DelegateList : public msgIDelegateList
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MSGIDELEGATELIST
-  explicit DelegateList(const char *aWindowsPrefix) :
-    mPrefix(aWindowsPrefix)
-  { }
+  DelegateList() { }
   nsDataHashtable<nsCStringHashKey, bool> mMethods;
 
 protected:
   virtual ~DelegateList() { }
-  nsCString mPrefix; // Windows decorated method prefix.
 };
 
 } // namespace mailnews
 } // namespace mozilla
 
 /*
  * This macro is used in forwarding functions.
  *   _jsdelegate: the name of the JS pointer that implements a particular
  *                interface.
  *   _jsmethods:  the DelegateList object
  *   _cppbase:    the C++ base instance (used when call not delegated to js)
  *
  **/
 
 #define DELEGATE_JS(_jsdelegate, _jsmethods, _cppbase) (\
     _jsdelegate && _jsmethods && \
-    _jsmethods->Contains(nsLiteralCString(__FUNCTION__)) ? \
+    _jsmethods->Contains(nsLiteralCString(__func__)) ? \
        _jsdelegate : (_cppbase))
 
 
 #endif
--- a/mailnews/jsaccount/src/JaAbDirectory.cpp
+++ b/mailnews/jsaccount/src/JaAbDirectory.cpp
@@ -47,17 +47,17 @@ NS_IMETHODIMP JaCppAbDirectoryDelegator:
   // We static_cast since we want to use the hash object directly.
   mDelegateList = static_cast<DelegateList*> (aDelegateList);
   mMethods = &(mDelegateList->mMethods);
   return NS_OK;
 }
 NS_IMETHODIMP JaCppAbDirectoryDelegator::GetMethodsToDelegate(msgIDelegateList** aDelegateList)
 {
   if (!mDelegateList)
-    mDelegateList = new DelegateList("mozilla::mailnews::JaCppAbDirectoryDelegator::");
+    mDelegateList = new DelegateList();
   mMethods = &(mDelegateList->mMethods);
   NS_ADDREF(*aDelegateList = mDelegateList);
   return NS_OK;
 }
 
 NS_IMETHODIMP JaCppAbDirectoryDelegator::SetJsDelegate(nsISupports* aJsDelegate)
 {
   // If these QIs fail, then overrides are not provided for methods in that
--- a/mailnews/jsaccount/src/JaCompose.cpp
+++ b/mailnews/jsaccount/src/JaCompose.cpp
@@ -53,17 +53,17 @@ JaCppComposeDelegator::SetMethodsToDeleg
   mDelegateList = static_cast<DelegateList*> (aDelegateList);
   mMethods = &(mDelegateList->mMethods);
   return NS_OK;
 }
 NS_IMETHODIMP
 JaCppComposeDelegator::GetMethodsToDelegate(msgIDelegateList** aDelegateList)
 {
   if (!mDelegateList)
-    mDelegateList = new DelegateList("mozilla::mailnews::JaCppComposeDelegator::");
+    mDelegateList = new DelegateList();
   mMethods = &(mDelegateList->mMethods);
   NS_ADDREF(*aDelegateList = mDelegateList);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 JaCppComposeDelegator::SetJsDelegate(nsISupports* aJsDelegate)
 {
--- a/mailnews/jsaccount/src/JaIncomingServer.cpp
+++ b/mailnews/jsaccount/src/JaIncomingServer.cpp
@@ -60,17 +60,17 @@ JaCppIncomingServerDelegator::SetMethods
   mDelegateList = static_cast<DelegateList*> (aDelegateList);
   mMethods = &(mDelegateList->mMethods);
   return NS_OK;
 }
 NS_IMETHODIMP
 JaCppIncomingServerDelegator::GetMethodsToDelegate(msgIDelegateList** aDelegateList)
 {
   if (!mDelegateList)
-    mDelegateList = new DelegateList("mozilla::mailnews::JaCppIncomingServerDelegator::");
+    mDelegateList = new DelegateList();
   mMethods = &(mDelegateList->mMethods);
   NS_ADDREF(*aDelegateList = mDelegateList);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 JaCppIncomingServerDelegator::SetJsDelegate(nsISupports* aJsDelegate)
 {
--- a/mailnews/jsaccount/src/JaMsgFolder.cpp
+++ b/mailnews/jsaccount/src/JaMsgFolder.cpp
@@ -155,17 +155,17 @@ JaCppMsgFolderDelegator::SetMethodsToDel
   mDelegateList = static_cast<DelegateList*> (aDelegateList);
   mMethods = &(mDelegateList->mMethods);
   return NS_OK;
 }
 NS_IMETHODIMP
 JaCppMsgFolderDelegator::GetMethodsToDelegate(msgIDelegateList** aDelegateList)
 {
   if (!mDelegateList)
-    mDelegateList = new DelegateList("mozilla::mailnews::JaCppMsgFolderDelegator::");
+    mDelegateList = new DelegateList();
   mMethods = &(mDelegateList->mMethods);
   NS_ADDREF(*aDelegateList = mDelegateList);
   return NS_OK;
 }
 
 NS_IMETHODIMP JaCppMsgFolderDelegator::SetJsDelegate(nsISupports* aJsDelegate)
 {
   // If these QIs fail, then overrides are not provided for methods in that
--- a/mailnews/jsaccount/src/JaSend.cpp
+++ b/mailnews/jsaccount/src/JaSend.cpp
@@ -53,17 +53,17 @@ JaCppSendDelegator::SetMethodsToDelegate
   mDelegateList = static_cast<DelegateList*> (aDelegateList);
   mMethods = &(mDelegateList->mMethods);
   return NS_OK;
 }
 NS_IMETHODIMP
 JaCppSendDelegator::GetMethodsToDelegate(msgIDelegateList** aDelegateList)
 {
   if (!mDelegateList)
-    mDelegateList = new DelegateList("mozilla::mailnews::JaCppSendDelegator::");
+    mDelegateList = new DelegateList();
   mMethods = &(mDelegateList->mMethods);
   NS_ADDREF(*aDelegateList = mDelegateList);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 JaCppSendDelegator::SetJsDelegate(nsISupports* aJsDelegate)
 {
--- a/mailnews/jsaccount/src/JaUrl.cpp
+++ b/mailnews/jsaccount/src/JaUrl.cpp
@@ -210,17 +210,17 @@ NS_IMETHODIMP JaCppUrlDelegator::SetMeth
   // We static_cast since we want to use the hash object directly.
   mDelegateList = static_cast<DelegateList*> (aDelegateList);
   mMethods = &(mDelegateList->mMethods);
   return NS_OK;
 }
 NS_IMETHODIMP JaCppUrlDelegator::GetMethodsToDelegate(msgIDelegateList **aDelegateList)
 {
   if (!mDelegateList)
-    mDelegateList = new DelegateList("mozilla::mailnews::JaCppUrlDelegator::");
+    mDelegateList = new DelegateList();
   mMethods = &(mDelegateList->mMethods);
   NS_ADDREF(*aDelegateList = mDelegateList);
   return NS_OK;
 }
 
 NS_IMETHODIMP JaCppUrlDelegator::SetJsDelegate(nsISupports *aJsDelegate)
 {
   // If these QIs fail, then overrides are not provided for methods in that