From 01869f299e325216ab20588ecaaa2286ecdcd2cc Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Wed, 17 Jan 2018 15:57:14 +0000 Subject: [PATCH] [Index] Fix GCC warning. This is silly, but no llvm_unreachable and no C99. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322672 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/c-index-test/c-index-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 0b66eff078..79b3a74b7c 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -724,13 +724,13 @@ static int lineCol_cmp(const void *p1, const void *p2) { } static CXString CursorToText(CXCursor Cursor) { + CXString text; switch (wanted_display_type) { case DisplayType_Spelling: return clang_getCursorSpelling(Cursor); case DisplayType_DisplayName: return clang_getCursorDisplayName(Cursor); case DisplayType_Pretty: { - CXString text; CXPrintingPolicy Policy = clang_getCursorPrintingPolicy(Cursor); ModifyPrintingPolicyAccordingToEnv(Policy); text = clang_getCursorPrettyPrinted(Cursor, Policy); @@ -738,6 +738,8 @@ static CXString CursorToText(CXCursor Cursor) { return text; } } + assert(0 && "unknown display type"); // no llvm_unreachable in C. + return text; // garbage } static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) { -- 2.40.0