Bug 920292 - Part 1: Stop passing string literals as the first argument to MOZ_ASSERT; r=Waldo
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 01 Oct 2013 08:25:08 -0400
changeset 149456 654969e2676ce6dd99f0c01b676945ba4df7923e
parent 149455 f4e88e5f24ca1d3540c1f9320c63c395e3febd57
child 149457 2786f006654ba812e66d5461912ba65ae7fe5c3e
push id25389
push userryanvm@gmail.com
push dateTue, 01 Oct 2013 20:35:30 +0000
treeherdermozilla-central@4364824a4cab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs920292
milestone27.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 920292 - Part 1: Stop passing string literals as the first argument to MOZ_ASSERT; r=Waldo
dom/audiochannel/AudioChannelService.cpp
dom/system/gonk/AudioManager.cpp
dom/wifi/NetUtils.h
js/src/assembler/assembler/MacroAssemblerARM.h
js/src/jit/arm/Assembler-arm.h
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -674,17 +674,17 @@ AudioChannelService::Observe(nsISupports
       audioManager->SetAudioChannelVolume(AUDIO_CHANNEL_CONTENT, index);
     } else if (keyStr.EqualsLiteral("audio.volume.notification")) {
       audioManager->SetAudioChannelVolume(AUDIO_CHANNEL_NOTIFICATION, index);
     } else if (keyStr.EqualsLiteral("audio.volume.alarm")) {
       audioManager->SetAudioChannelVolume(AUDIO_CHANNEL_ALARM, index);
     } else if (keyStr.EqualsLiteral("audio.volume.telephony")) {
       audioManager->SetAudioChannelVolume(AUDIO_CHANNEL_TELEPHONY, index);
     } else {
-      MOZ_ASSERT("unexpected audio channel for volume control");
+      MOZ_ASSUME_UNREACHABLE("unexpected audio channel for volume control");
     }
   }
 #endif
 
   return NS_OK;
 }
 
 AudioChannelService::AudioChannelInternalType
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -133,17 +133,17 @@ public:
     } else if (aName.EqualsLiteral("audio.volume.alarm")) {
       audioManager->SetAudioChannelVolume(AUDIO_CHANNEL_ALARM, volIndex);
     } else if (aName.EqualsLiteral("audio.volume.telephony")) {
       audioManager->SetAudioChannelVolume(AUDIO_CHANNEL_TELEPHONY, volIndex);
     } else if (aName.EqualsLiteral("audio.volume.bt_sco")) {
       static_cast<AudioManager *>(audioManager.get())->SetStreamVolumeIndex(
         AUDIO_STREAM_BLUETOOTH_SCO, volIndex);
     } else {
-      MOZ_ASSERT("unexpected audio channel for volume control");
+      MOZ_ASSUME_UNREACHABLE("unexpected audio channel for volume control");
     }
 
     return NS_OK;
   }
 
   NS_IMETHOD HandleError(const nsAString& aName)
   {
     LOG("AudioChannelVolInitCallback::HandleError: %s\n",
--- a/dom/wifi/NetUtils.h
+++ b/dom/wifi/NetUtils.h
@@ -49,12 +49,12 @@ public:
 
 // Defines a function type with the right arguments and return type.
 #define DEFINE_DLFUNC(name, ret, args...) typedef ret (*FUNC##name)(args);
 
 // Set up a dlsymed function ready to use.
 #define USE_DLFUNC(name)                                                      \
   FUNC##name name = (FUNC##name) dlsym(GetSharedLibrary(), #name);            \
   if (!name) {                                                                \
-    MOZ_ASSERT("Symbol not found in shared library : " #name);                \
+    MOZ_ASSUME_UNREACHABLE("Symbol not found in shared library : " #name);         \
   }
 
 #endif // NetUtils_h
--- a/js/src/assembler/assembler/MacroAssemblerARM.h
+++ b/js/src/assembler/assembler/MacroAssemblerARM.h
@@ -473,41 +473,41 @@ public:
     void store16(RegisterID src, BaseIndex address)
     {
         m_assembler.baseIndexTransferN(false, false, 16, src, address.base, address.index, static_cast<int>(address.scale), address.offset);
     }
 
     void store16(TrustedImm32 imm, BaseIndex address)
     {
         if (imm.m_isPointer)
-            JS_ASSERT("What are you trying to do with 16 bits of a pointer?");
+            MOZ_ASSUME_UNREACHABLE("What are you trying to do with 16 bits of a pointer?");
         else
             move(imm, ARMRegisters::S1);
         store16(ARMRegisters::S1, address);
     }
     void store16(TrustedImm32 imm, ImplicitAddress address)
     {
         if (imm.m_isPointer)
-            JS_ASSERT("What are you trying to do with 16 bits of a pointer?");
+            MOZ_ASSUME_UNREACHABLE("What are you trying to do with 16 bits of a pointer?");
         else
             move(imm, ARMRegisters::S1);
         store16(ARMRegisters::S1, address);
     }
 
     void store16(RegisterID src, void* address)
     {
         m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
         m_assembler.mem_imm_off(false, false, 16, true, src, ARMRegisters::S0, 0);
     }
 
     void store16(TrustedImm32 imm, void* address)
     {
         m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
         if (imm.m_isPointer)
-            JS_ASSERT("What are you trying to do with 16 bits of a pointer?");
+            MOZ_ASSUME_UNREACHABLE("What are you trying to do with 16 bits of a pointer?");
         else
             m_assembler.moveImm(imm.m_value, ARMRegisters::S1);
         m_assembler.mem_imm_off(false, false, 16, true, ARMRegisters::S1, ARMRegisters::S0, 0);
     }
 
     void store8(RegisterID src, ImplicitAddress address)
     {
         m_assembler.dataTransferN(false, false, 8,  src, address.base, address.offset);
@@ -516,42 +516,42 @@ public:
     void store8(RegisterID src, BaseIndex address)
     {
         m_assembler.baseIndexTransferN(false, false, 8, src, address.base, address.index, static_cast<int>(address.scale), address.offset);
     }
 
     void store8(TrustedImm32 imm, BaseIndex address)
     {
         if (imm.m_isPointer)
-            JS_ASSERT("What are you trying to do with 8 bits of a pointer?");
+            MOZ_ASSUME_UNREACHABLE("What are you trying to do with 8 bits of a pointer?");
         else
             move(imm, ARMRegisters::S1);
         store8(ARMRegisters::S1, address);
     }
 
     void store8(TrustedImm32 imm, ImplicitAddress address)
     {
         if (imm.m_isPointer)
-            JS_ASSERT("What are you trying to do with 16 bits of a pointer?");
+            MOZ_ASSUME_UNREACHABLE("What are you trying to do with 16 bits of a pointer?");
         else
             move(imm, ARMRegisters::S1);
         store8(ARMRegisters::S1, address);
     }
 
     void store8(RegisterID src, void* address)
     {
         m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
         m_assembler.mem_imm_off(false, false, 8, true, src, ARMRegisters::S0, 0);
     }
 
     void store8(TrustedImm32 imm, void* address)
     {
         m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
         if (imm.m_isPointer)
-            JS_ASSERT("What are you trying to do with 16 bits of a pointer?");
+            MOZ_ASSUME_UNREACHABLE("What are you trying to do with 16 bits of a pointer?");
         else
             m_assembler.moveImm(imm.m_value, ARMRegisters::S1);
         m_assembler.mem_imm_off(false, false, 8, true, ARMRegisters::S1, ARMRegisters::S0, 0);
     }
 
     void pop(RegisterID dest)
     {
         m_assembler.pop_r(dest);
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1697,17 +1697,17 @@ class Assembler
         dtmMode = mode;
     }
 
     void transferReg(Register rn) {
         JS_ASSERT(dtmActive);
         JS_ASSERT(rn.code() > dtmLastReg);
         dtmRegBitField |= 1 << rn.code();
         if (dtmLoadStore == IsLoad && rn.code() == 13 && dtmBase.code() == 13) {
-            JS_ASSERT("ARM Spec says this is invalid");
+            MOZ_ASSUME_UNREACHABLE("ARM Spec says this is invalid");
         }
     }
     void finishDataTransfer() {
         dtmActive = false;
         as_dtm(dtmLoadStore, dtmBase, dtmRegBitField, dtmMode, dtmUpdate, dtmCond);
     }
 
     void startFloatTransferM(LoadStore ls, Register rm,