Bug 1315812 - Mark nsISupportsArray, nsICollection, nsIEnumerator as deprecated. r=froydnj

This marks the idl classes as deprecated, removes an unnecessary include that
was triggering deprecation warnings and wraps a necessary include in
XPCOMInit.cpp that is used for registering the component in deprecation
disabling pragmas.

MozReview-Commit-ID: BbNU5q8O4Q4
This commit is contained in:
Eric Rahm 2016-11-10 13:15:33 -08:00
parent a79e2262d5
commit 5ae299f0d8
11 changed files with 109 additions and 9 deletions

View File

@ -29,7 +29,6 @@
#include "nsUnicharUtils.h"
#include "nsIStringEnumerator.h"
#include "nsCRT.h"
#include "nsSupportsArray.h"
#include "nsContentCID.h"
#include "nsStreamUtils.h"

View File

@ -63,7 +63,6 @@
#include "nsIAtomService.h"
#include "nsICategoryManager.h"
#include "nsIClassInfo.h"
#include "nsICollection.h"
#include "nsIComponentManager.h"
#include "nsIConsoleListener.h"
#include "nsIConsoleMessage.h"

View File

@ -38,7 +38,24 @@
#include "nsTraceRefcnt.h"
#include "nsErrorService.h"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4996)
#endif
#include "nsSupportsArray.h"
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop)
#endif
#include "nsArray.h"
#include "nsINIParserImpl.h"
#include "nsSupportsPrimitives.h"

View File

@ -7,7 +7,7 @@
interface nsIEnumerator;
[scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)]
[deprecated, scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)]
interface nsICollection : nsISerializable
{

View File

@ -16,7 +16,7 @@
*
* DON'T MAKE ME COME OVER THERE.
*/
[scriptable, uuid(ad385286-cbc4-11d2-8cca-0060b0fc14a3)]
[deprecated, scriptable, uuid(ad385286-cbc4-11d2-8cca-0060b0fc14a3)]
interface nsIEnumerator : nsISupports {
/** First will reset the list. will return NS_FAILED if no items
*/
@ -37,7 +37,7 @@ interface nsIEnumerator : nsISupports {
void isDone();
};
[uuid(75f158a0-cadd-11d2-8cca-0060b0fc14a3)]
[deprecated, uuid(75f158a0-cadd-11d2-8cca-0060b0fc14a3)]
interface nsIBidirectionalEnumerator : nsIEnumerator {
/** Last will reset the list to the end. will return NS_FAILED if no items

View File

@ -30,7 +30,7 @@ class nsISupportsArray;
%}
[scriptable, uuid(241addc8-3608-4e73-8083-2fd6fa09eba2)]
[deprecated, scriptable, uuid(241addc8-3608-4e73-8083-2fd6fa09eba2)]
interface nsISupportsArray : nsICollection {
[notxpcom] long IndexOf([const] in nsISupports aPossibleElement);

View File

@ -13,6 +13,16 @@
#include "nsSupportsArray.h"
#include "nsSupportsArrayEnumerator.h"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4996)
#endif
nsresult
nsQueryElementAt::operator()(const nsIID& aIID, void** aResult) const
{
@ -245,3 +255,10 @@ nsSupportsArray::Enumerate(nsISimpleEnumerator** aResult)
{
return NS_NewArrayEnumerator(aResult, this);
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop)
#endif

View File

@ -8,10 +8,22 @@
#define nsSupportsArray_h__
#include "nsIArray.h"
#include "nsISupportsArray.h"
#include "nsCOMArray.h"
#include "mozilla/Attributes.h"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4996)
#endif
#include "nsISupportsArray.h"
class nsSupportsArray final : public nsISupportsArray,
public nsIArray
{
@ -86,4 +98,10 @@ private:
nsCOMArray<nsISupports> mArray;
};
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop)
#endif
#endif // nsSupportsArray_h__

View File

@ -5,6 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSupportsArrayEnumerator.h"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4996)
#endif
#include "nsISupportsArray.h"
nsSupportsArrayEnumerator::nsSupportsArrayEnumerator(nsISupportsArray* array)
@ -113,3 +124,8 @@ nsSupportsArrayEnumerator::Prev()
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop)
#endif

View File

@ -8,9 +8,20 @@
#define nsSupportsArrayEnumerator_h___
#include "nsCOMPtr.h"
#include "nsIEnumerator.h"
#include "mozilla/Attributes.h"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4996)
#endif
#include "nsIEnumerator.h"
class nsISupportsArray;
class nsSupportsArrayEnumerator final : public nsIBidirectionalEnumerator
@ -35,5 +46,11 @@ protected:
};
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop)
#endif
#endif // __nsSupportsArrayEnumerator_h

View File

@ -6,9 +6,20 @@
#include <stdio.h>
#include <stdlib.h>
#include "nsISupportsArray.h"
#include "gtest/gtest.h"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4996)
#endif
#include "nsISupportsArray.h"
// {9e70a320-be02-11d1-8031-006008159b5a}
#define NS_IFOO_IID \
{0x9e70a320, 0xbe02, 0x11d1, \
@ -150,3 +161,9 @@ TEST(Array, main)
NS_RELEASE(array);
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop)
#endif