Bug 1416164 - Replace NS_NOTYETIMPLEMENTED with MOZ_ASSERT_UNREACHABLE. r=froydnj
authorChris Peterson <cpeterson@mozilla.com>
Wed, 25 Oct 2017 00:37:02 -0700
changeset 391364 c555efc9304855265098872a0e66a0c03b3117a0
parent 391363 7b970d24b438a9735dfe7f4934d5cab1f04de33d
child 391365 4d7c0110f849a28f5cee9a98291c0c5c4a2eb176
push id32873
push userapavel@mozilla.com
push dateSat, 11 Nov 2017 09:58:24 +0000
treeherdermozilla-central@21f9b2532a40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1416164
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1416164 - Replace NS_NOTYETIMPLEMENTED with MOZ_ASSERT_UNREACHABLE. r=froydnj MozReview-Commit-ID: B5TZB3v52wY
dom/base/Element.cpp
dom/html/HTMLInputElement.cpp
dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp
layout/style/nsDOMCSSValueList.cpp
layout/style/nsRuleNode.cpp
netwerk/base/nsStandardURL.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
rdf/base/nsCompositeDataSource.cpp
rdf/datasource/nsFileSystemDataSource.cpp
xpcom/base/nsDebug.h
xpcom/threads/BlockingResourceBase.cpp
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -2218,17 +2218,17 @@ Element::GetMappedAttributes() const
   return mAttrsAndChildren.GetMapped();
 }
 
 nsresult
 Element::SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
                                    const nsAString* aSerialized,
                                    bool aNotify)
 {
-  NS_NOTYETIMPLEMENTED("Element::SetInlineStyleDeclaration");
+  MOZ_ASSERT_UNREACHABLE("Element::SetInlineStyleDeclaration");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP_(bool)
 Element::IsAttributeMapped(const nsAtom* aAttribute) const
 {
   return false;
 }
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -6932,17 +6932,17 @@ HTMLInputElement::GetValueMode() const
     case NS_FORM_INPUT_DATE:
     case NS_FORM_INPUT_TIME:
     case NS_FORM_INPUT_COLOR:
     case NS_FORM_INPUT_MONTH:
     case NS_FORM_INPUT_WEEK:
     case NS_FORM_INPUT_DATETIME_LOCAL:
       return VALUE_MODE_VALUE;
     default:
-      NS_NOTYETIMPLEMENTED("Unexpected input type in GetValueMode()");
+      MOZ_ASSERT_UNREACHABLE("Unexpected input type in GetValueMode()");
       return VALUE_MODE_VALUE;
 #else // DEBUG
     default:
       return VALUE_MODE_VALUE;
 #endif // DEBUG
   }
 }
 
@@ -6980,17 +6980,17 @@ HTMLInputElement::DoesReadOnlyApply() co
     case NS_FORM_INPUT_NUMBER:
     case NS_FORM_INPUT_DATE:
     case NS_FORM_INPUT_TIME:
     case NS_FORM_INPUT_MONTH:
     case NS_FORM_INPUT_WEEK:
     case NS_FORM_INPUT_DATETIME_LOCAL:
       return true;
     default:
-      NS_NOTYETIMPLEMENTED("Unexpected input type in DoesReadOnlyApply()");
+      MOZ_ASSERT_UNREACHABLE("Unexpected input type in DoesReadOnlyApply()");
       return true;
 #else // DEBUG
     default:
       return true;
 #endif // DEBUG
   }
 }
 
@@ -7020,17 +7020,17 @@ HTMLInputElement::DoesRequiredApply() co
     case NS_FORM_INPUT_NUMBER:
     case NS_FORM_INPUT_DATE:
     case NS_FORM_INPUT_TIME:
     case NS_FORM_INPUT_MONTH:
     case NS_FORM_INPUT_WEEK:
     case NS_FORM_INPUT_DATETIME_LOCAL:
       return true;
     default:
-      NS_NOTYETIMPLEMENTED("Unexpected input type in DoesRequiredApply()");
+      MOZ_ASSERT_UNREACHABLE("Unexpected input type in DoesRequiredApply()");
       return true;
 #else // DEBUG
     default:
       return true;
 #endif // DEBUG
   }
 }
 
@@ -7070,17 +7070,17 @@ HTMLInputElement::DoesMinMaxApply() cons
     case NS_FORM_INPUT_PASSWORD:
     case NS_FORM_INPUT_SEARCH:
     case NS_FORM_INPUT_TEL:
     case NS_FORM_INPUT_EMAIL:
     case NS_FORM_INPUT_URL:
     case NS_FORM_INPUT_COLOR:
       return false;
     default:
-      NS_NOTYETIMPLEMENTED("Unexpected input type in DoesRequiredApply()");
+      MOZ_ASSERT_UNREACHABLE("Unexpected input type in DoesRequiredApply()");
       return false;
 #else // DEBUG
     default:
       return false;
 #endif // DEBUG
   }
 }
 
@@ -7110,17 +7110,17 @@ HTMLInputElement::DoesAutocompleteApply(
     case NS_FORM_INPUT_SUBMIT:
     case NS_FORM_INPUT_IMAGE:
     case NS_FORM_INPUT_BUTTON:
     case NS_FORM_INPUT_RADIO:
     case NS_FORM_INPUT_CHECKBOX:
     case NS_FORM_INPUT_FILE:
       return false;
     default:
-      NS_NOTYETIMPLEMENTED("Unexpected input type in DoesAutocompleteApply()");
+      MOZ_ASSERT_UNREACHABLE("Unexpected input type in DoesAutocompleteApply()");
       return false;
 #else // DEBUG
     default:
       return false;
 #endif // DEBUG
   }
 }
 
--- a/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp
+++ b/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp
@@ -788,17 +788,17 @@ nsXULTemplateQueryProcessorRDF::OnMove(n
                                        nsIRDFResource* aNewSource,
                                        nsIRDFResource* aProperty,
                                        nsIRDFNode* aTarget)
 {
     // Ignore updates if we're batching
     if (mUpdateBatchNest)
         return NS_OK;
 
-    NS_NOTYETIMPLEMENTED("write me");
+    MOZ_ASSERT_UNREACHABLE("write me");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 
 NS_IMETHODIMP
 nsXULTemplateQueryProcessorRDF::OnBeginUpdateBatch(nsIRDFDataSource* aDataSource)
 {
     mUpdateBatchNest++;
--- a/layout/style/nsDOMCSSValueList.cpp
+++ b/layout/style/nsDOMCSSValueList.cpp
@@ -101,17 +101,17 @@ nsDOMCSSValueList::GetCssText(nsString& 
 
 NS_IMETHODIMP
 nsDOMCSSValueList::SetCssText(const nsAString& aCssText)
 {
   if (mReadonly) {
     return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
   }
 
-  NS_NOTYETIMPLEMENTED("Can't SetCssText yet: please write me!");
+  MOZ_ASSERT_UNREACHABLE("Can't SetCssText yet: please write me!");
   return NS_OK;
 }
 
 void
 nsDOMCSSValueList::SetCssText(const nsAString& aText, ErrorResult& aRv)
 {
   aRv = SetCssText(aText);
 }
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -4840,23 +4840,22 @@ nsRuleNode::ComputeTextData(void* aStart
         } else {
           lh = minimumFontSize;
         }
       }
       text->mLineHeight.SetCoordValue(lh);
     }
   }
 
-
   // text-align: enum, string, pair(enum|string), inherit, initial
   // NOTE: string is not implemented yet.
   const nsCSSValue* textAlignValue = aRuleData->ValueForTextAlign();
   text->mTextAlignTrue = false;
   if (eCSSUnit_String == textAlignValue->GetUnit()) {
-    NS_NOTYETIMPLEMENTED("align string");
+    MOZ_ASSERT_UNREACHABLE("align string");
   } else if (eCSSUnit_Enumerated == textAlignValue->GetUnit() &&
              NS_STYLE_TEXT_ALIGN_MOZ_CENTER_OR_INHERIT ==
                textAlignValue->GetIntValue()) {
     conditions.SetUncacheable();
     uint8_t parentAlign = parentText->mTextAlign;
     text->mTextAlign = (NS_STYLE_TEXT_ALIGN_START == parentAlign) ?
       NS_STYLE_TEXT_ALIGN_CENTER : parentAlign;
   } else if (eCSSUnit_Enumerated == textAlignValue->GetUnit() &&
@@ -4888,17 +4887,17 @@ nsRuleNode::ComputeTextData(void* aStart
       text->mTextAlignTrue = true;
       const nsCSSValuePair& textAlignValuePair = textAlignValue->GetPairValue();
       textAlignValue = &textAlignValuePair.mXValue;
       if (eCSSUnit_Enumerated == textAlignValue->GetUnit()) {
         if (textAlignValue->GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE) {
           textAlignValue = &textAlignValuePair.mYValue;
         }
       } else if (eCSSUnit_String == textAlignValue->GetUnit()) {
-        NS_NOTYETIMPLEMENTED("align string");
+        MOZ_ASSERT_UNREACHABLE("align string");
       }
     } else if (eCSSUnit_Inherit == textAlignValue->GetUnit() ||
                eCSSUnit_Unset == textAlignValue->GetUnit()) {
       text->mTextAlignTrue = parentText->mTextAlignTrue;
     }
     SetValue(*textAlignValue, text->mTextAlign, conditions,
              SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
              parentText->mTextAlign,
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -3049,17 +3049,17 @@ nsStandardURL::SetRef(const nsACString &
     mPath.mLen += shift;
     mRef.mLen = refLen;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStandardURL::SetDirectory(const nsACString &input)
 {
-    NS_NOTYETIMPLEMENTED("");
+    MOZ_ASSERT_UNREACHABLE("SetDirectory");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsStandardURL::SetFileName(const nsACString &input)
 {
     ENSURE_MUTABLE();
 
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -767,17 +767,17 @@ HttpBaseChannel::GetContentLength(int64_
 
   *aContentLength = mResponseHead->ContentLength();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpBaseChannel::SetContentLength(int64_t value)
 {
-  NS_NOTYETIMPLEMENTED("HttpBaseChannel::SetContentLength");
+  MOZ_ASSERT_UNREACHABLE("HttpBaseChannel::SetContentLength");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 HttpBaseChannel::Open(nsIInputStream **aResult)
 {
   NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_IN_PROGRESS);
 
--- a/rdf/base/nsCompositeDataSource.cpp
+++ b/rdf/base/nsCompositeDataSource.cpp
@@ -1063,17 +1063,17 @@ CompositeDataSourceImpl::ArcLabelsOut(ns
     NS_ADDREF(result);
     *aResult = result;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 CompositeDataSourceImpl::GetAllResources(nsISimpleEnumerator** aResult)
 {
-    NS_NOTYETIMPLEMENTED("CompositeDataSourceImpl::GetAllResources");
+    MOZ_ASSERT_UNREACHABLE("CompositeDataSourceImpl::GetAllResources");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 CompositeDataSourceImpl::GetAllCmds(nsIRDFResource* source,
                                     nsISimpleEnumerator/*<nsIRDFResource>*/** result)
 {
     nsresult rv;
--- a/rdf/datasource/nsFileSystemDataSource.cpp
+++ b/rdf/datasource/nsFileSystemDataSource.cpp
@@ -245,17 +245,17 @@ FileSystemDataSource::GetSource(nsIRDFRe
 
 
 NS_IMETHODIMP
 FileSystemDataSource::GetSources(nsIRDFResource *property,
                                  nsIRDFNode *target,
                                  bool tv,
                                  nsISimpleEnumerator **sources /* out */)
 {
-//  NS_NOTYETIMPLEMENTED("write me");
+//  MOZ_ASSERT_UNREACHABLE("write me");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 
 
 NS_IMETHODIMP
 FileSystemDataSource::GetTarget(nsIRDFResource *source,
                                 nsIRDFResource *property,
@@ -700,17 +700,17 @@ FileSystemDataSource::HasArcOut(nsIRDFRe
 }
 
 
 
 NS_IMETHODIMP
 FileSystemDataSource::ArcLabelsIn(nsIRDFNode *node,
                             nsISimpleEnumerator ** labels /* out */)
 {
-//  NS_NOTYETIMPLEMENTED("write me");
+//  MOZ_ASSERT_UNREACHABLE("write me");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 
 
 NS_IMETHODIMP
 FileSystemDataSource::ArcLabelsOut(nsIRDFResource *source,
                    nsISimpleEnumerator **labels /* out */)
@@ -757,17 +757,17 @@ FileSystemDataSource::ArcLabelsOut(nsIRD
     return NS_NewEmptyEnumerator(labels);
 }
 
 
 
 NS_IMETHODIMP
 FileSystemDataSource::GetAllResources(nsISimpleEnumerator** aCursor)
 {
-    NS_NOTYETIMPLEMENTED("sorry!");
+    MOZ_ASSERT_UNREACHABLE("sorry!");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 
 
 NS_IMETHODIMP
 FileSystemDataSource::AddObserver(nsIRDFObserver *n)
 {
--- a/xpcom/base/nsDebug.h
+++ b/xpcom/base/nsDebug.h
@@ -108,30 +108,16 @@ inline void MOZ_PretendNoReturn()
 /**
  * NS_PRECONDITION/POSTCONDITION are synonyms for NS_ASSERTION.
  */
 #define NS_PRECONDITION(expr, str) NS_ASSERTION(expr, str)
 #define NS_POSTCONDITION(expr, str) NS_ASSERTION(expr, str)
 
 /**
  * This macros triggers a program failure if executed. It indicates that
- * an attempt was made to execute some unimplemented functionality.
- */
-#ifdef DEBUG
-#define NS_NOTYETIMPLEMENTED(str)                             \
-  do {                                                        \
-    NS_DebugBreak(NS_DEBUG_ASSERTION, str, "NotYetImplemented", __FILE__, __LINE__); \
-    MOZ_PretendNoReturn();                                    \
-  } while(0)
-#else
-#define NS_NOTYETIMPLEMENTED(str)      do { /* nothing */ } while(0)
-#endif
-
-/**
- * This macros triggers a program failure if executed. It indicates that
  * an attempt was made to execute a codepath which should not be reachable.
  */
 #ifdef DEBUG
 #define NS_NOTREACHED(str)                                    \
   do {                                                        \
     NS_DebugBreak(NS_DEBUG_ASSERTION, str, "Not Reached", __FILE__, __LINE__); \
     MOZ_PretendNoReturn();                                    \
   } while(0)
--- a/xpcom/threads/BlockingResourceBase.cpp
+++ b/xpcom/threads/BlockingResourceBase.cpp
@@ -266,17 +266,17 @@ BlockingResourceBase::Shutdown()
   sDeadlockDetector = 0;
 }
 
 
 void
 BlockingResourceBase::CheckAcquire()
 {
   if (mType == eCondVar) {
-    NS_NOTYETIMPLEMENTED(
+    MOZ_ASSERT_UNREACHABLE(
       "FIXME bug 456272: annots. to allow CheckAcquire()ing condvars");
     return;
   }
 
   BlockingResourceBase* chainFront = ResourceChainFront();
   nsAutoPtr<DDT::ResourceAcquisitionArray> cycle(
     sDeadlockDetector->CheckAcquisition(
       chainFront ? chainFront : 0, this));
@@ -310,17 +310,17 @@ BlockingResourceBase::CheckAcquire()
   }
 }
 
 
 void
 BlockingResourceBase::Acquire()
 {
   if (mType == eCondVar) {
-    NS_NOTYETIMPLEMENTED(
+    MOZ_ASSERT_UNREACHABLE(
       "FIXME bug 456272: annots. to allow Acquire()ing condvars");
     return;
   }
   NS_ASSERTION(!IsAcquired(),
                "reacquiring already acquired resource");
 
   ResourceChainAppend(ResourceChainFront());
 
@@ -335,17 +335,17 @@ BlockingResourceBase::Acquire()
 #endif
 }
 
 
 void
 BlockingResourceBase::Release()
 {
   if (mType == eCondVar) {
-    NS_NOTYETIMPLEMENTED(
+    MOZ_ASSERT_UNREACHABLE(
       "FIXME bug 456272: annots. to allow Release()ing condvars");
     return;
   }
 
   BlockingResourceBase* chainFront = ResourceChainFront();
   NS_ASSERTION(chainFront && IsAcquired(),
                "Release()ing something that hasn't been Acquire()ed");
 
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -1366,11 +1366,11 @@ nsDirectoryViewerFactory::CreateInstance
 
 
 NS_IMETHODIMP
 nsDirectoryViewerFactory::CreateInstanceForDocument(nsISupports* aContainer,
                                                     nsIDocument* aDocument,
                                                     const char *aCommand,
                                                     nsIContentViewer** aDocViewerResult)
 {
-  NS_NOTYETIMPLEMENTED("didn't expect to get here");
+  MOZ_ASSERT_UNREACHABLE("didn't expect to get here");
   return NS_ERROR_NOT_IMPLEMENTED;
 }