diff --git a/indra/newview/fslslpreproc.cpp b/indra/newview/fslslpreproc.cpp
index a774b17877..5ac6c6dcd9 100644
--- a/indra/newview/fslslpreproc.cpp
+++ b/indra/newview/fslslpreproc.cpp
@@ -43,6 +43,7 @@
#include "llvfile.h"
#include "llviewercontrol.h"
#include "llcompilequeue.h"
+#include "llnotificationsutil.h"
#ifdef __GNUC__
// There is a sprintf( ... "%d", size_t_value) buried inside boost::wave. In order to not mess with system header, I rather disable that warning here.
@@ -980,7 +981,7 @@ static std::string minimalize_whitespace(std::string in)
}
*/
-static std::string reformat_switch_statements(std::string script)
+static std::string reformat_switch_statements(std::string script, bool &lackDefault)
{
std::string buffer = script;
{
@@ -1017,7 +1018,7 @@ static std::string reformat_switch_statements(std::string script)
S32 cutlen = slen + arg.length() + rstate.length();
// Call recursively to process nested switch statements (FIRE-10517)
- rstate = reformat_switch_statements(rstate);
+ rstate = reformat_switch_statements(rstate, lackDefault);
//rip off the scope edges
S32 slicestart = rstate.find("{") + 1;
@@ -1075,7 +1076,7 @@ static std::string reformat_switch_statements(std::string script)
}
std::string deflt = quicklabel();
- bool isdflt = false;
+ bool hasdflt = false;
std::string defstate;
defstate = boost::regex_replace(rstate, boost::regex(rDOT_MATCHES_NEWLINE
rCMNT_OR_STR "|" rSPC "++"
@@ -1083,7 +1084,7 @@ static std::string reformat_switch_statements(std::string script)
, boost::regex::perl), "?1@" + deflt + ";$2:$&", boost::format_all);
if (defstate != rstate)
{
- isdflt = true;
+ hasdflt = true;
rstate = defstate;
}
std::string argl;
@@ -1094,19 +1095,22 @@ static std::string reformat_switch_statements(std::string script)
{
jumptable += "if(" + arg + " == (" + ifs_it->first + "))jump " + ifs_it->second + ";\n";
}
- if (isdflt)
+ std::string brk = quicklabel();
+ if (!hasdflt)
{
- jumptable += "jump " + deflt + ";\n";
+ // Add jump to break position if there's no default (FIRE-17710)
+ deflt = brk;
+ lackDefault = true;
}
+ jumptable += "jump " + deflt + ";\n";
rstate = jumptable + rstate + "\n";
- std::string brk = quicklabel();
defstate = boost::regex_replace(rstate, boost::regex(rDOT_MATCHES_NEWLINE
rCMNT_OR_STR "|"
"(?doSaveComplete((void*)mCore, mClose, mSync);
}
}
+ if (lackDefault)
+ {
+ LLNotificationsUtil::add("DefaultLabelMissing");
+ }
mWaving = false;
}
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 7658f277ec..dc1e0ce913 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -10659,6 +10659,19 @@ Current setting: [CURRENT_VALUE]
+
+
+
+The behavior for switch() statements without a default case was previously incorrect and has been fixed.
+See FIRE-17710 for details.
+
+
+