enable the |ASSERT_NO_QUERY_NEEDED| tests for the |getter_AddRefs()| case as well. bug #26420, r=dougt

git-svn-id: svn://10.0.0.236/trunk@59952 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%netscape.com 2000-02-06 21:17:51 +00:00
parent 9d79e5f7ea
commit cc2ea1310a
4 changed files with 16 additions and 10 deletions

View File

@ -28,7 +28,12 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
{
nsresult status;
if ( mRawPtr )
status = mRawPtr->QueryInterface(aIID, answer);
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else
status = NS_ERROR_NULL_POINTER;

View File

@ -98,7 +98,7 @@
#ifdef NS_DEBUG
#define NSCAP_FEATURE_TEST_DONTQUERY_CASES
#define NSCAP_FEATURE_DEBUG_PTR_TYPES
#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
//#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
#endif
/*
@ -185,7 +185,7 @@ class nsDerivedSafe : public T
/*
Compiler warnings and errors: nsDerivedSafe operator=() hides inherited operator=().
If you see that, that means somebody checked in a (XP)COM interface class that declares an
If you see that, that means somebody checked in a [XP]COM interface class that declares an
|operator=()|, and that's _bad_. So bad, in fact, that this declaration exists explicitly
to stop people from doing it.
*/
@ -835,13 +835,11 @@ class nsGetterAddRefs
// nothing else to do
}
#if 0
#ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES
~nsGetterAddRefs()
{
mTargetSmartPtr.Assert_NoQueryNeeded();
}
#endif
#endif
operator void**()

View File

@ -28,7 +28,12 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
{
nsresult status;
if ( mRawPtr )
status = mRawPtr->QueryInterface(aIID, answer);
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else
status = NS_ERROR_NULL_POINTER;

View File

@ -98,7 +98,7 @@
#ifdef NS_DEBUG
#define NSCAP_FEATURE_TEST_DONTQUERY_CASES
#define NSCAP_FEATURE_DEBUG_PTR_TYPES
#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
//#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
#endif
/*
@ -185,7 +185,7 @@ class nsDerivedSafe : public T
/*
Compiler warnings and errors: nsDerivedSafe operator=() hides inherited operator=().
If you see that, that means somebody checked in a (XP)COM interface class that declares an
If you see that, that means somebody checked in a [XP]COM interface class that declares an
|operator=()|, and that's _bad_. So bad, in fact, that this declaration exists explicitly
to stop people from doing it.
*/
@ -835,13 +835,11 @@ class nsGetterAddRefs
// nothing else to do
}
#if 0
#ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES
~nsGetterAddRefs()
{
mTargetSmartPtr.Assert_NoQueryNeeded();
}
#endif
#endif
operator void**()