From 4107ef41192c89d7ae5199b9a3be26bf345ab0cd Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sun, 29 Sep 2013 21:18:26 -0700 Subject: [PATCH] Bug 921582: Avoid a 'may be used uninitialized' warning. r=waldo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifically: In file included from ./../../dist/include/js/CallArgs.h:39:0, from ./../../dist/include/js/CallNonGenericMethod.h:12, from /home/jimb/moz/dbg/js/src/NamespaceImports.h:15, from /home/jimb/moz/dbg/js/src/builtin/Intl.h:10, from /home/jimb/moz/dbg/js/src/builtin/Intl.cpp:12: ./../../dist/include/js/Value.h: In function ‘bool js::intl_CompareStrings(JSContext*, unsigned int, JS::Value*)’: ./../../dist/include/js/Value.h:653:58: warning: ‘res’ may be used uninitialized in this function [-Wmaybe-uninitialized] JS_RETURN_LAYOUT_FROM_BITS(((uint64_t)(uint32_t)i32) | JSVAL_SHIFTED_TAG_INT32); ^ /home/jimb/moz/dbg/js/src/builtin/Intl.cpp:968:13: note: ‘res’ was declared here int32_t res; ^ --- js/src/builtin/Intl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index c3123c6e0545..0ee33f961d78 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -970,6 +970,7 @@ intl_CompareStrings(JSContext *cx, UCollator *coll, HandleString str1, HandleStr case UCOL_LESS: res = -1; break; case UCOL_EQUAL: res = 0; break; case UCOL_GREATER: res = 1; break; + default: MOZ_ASSUME_UNREACHABLE("ucol_strcoll returned bad UCollationResult"); } result.setInt32(res); return true;