[clang-tools-extra] r365736 - [clang-doc] Silence compiler warning with gcc 7.4 [NFC]

Mikael Holmen via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 10 23:50:10 PDT 2019


Author: uabelho
Date: Wed Jul 10 23:50:10 2019
New Revision: 365736

URL: http://llvm.org/viewvc/llvm-project?rev=365736&view=rev
Log:
[clang-doc] Silence compiler warning with gcc 7.4 [NFC]

Without the fix gcc 7.4.0 complains with

/data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp: In member function 'llvm::SmallString<16> clang::doc::{anonymous}::HTMLTag::ToString() const':
/data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp:165:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
/data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp: In member function 'bool clang::doc::{anonymous}::HTMLTag::HasInlineChildren() const':
/data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp:142:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
/data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp: In member function 'bool clang::doc::{anonymous}::HTMLTag::IsSelfClosing() const':
/data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp:126:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1plus: all warnings being treated as errors

Modified:
    clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp

Modified: clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp?rev=365736&r1=365735&r2=365736&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp Wed Jul 10 23:50:10 2019
@@ -123,6 +123,7 @@ bool HTMLTag::IsSelfClosing() const {
   case HTMLTag::TAG_LI:
     return false;
   }
+  llvm_unreachable("Unhandled HTMLTag::TagType");
 }
 
 bool HTMLTag::HasInlineChildren() const {
@@ -139,6 +140,7 @@ bool HTMLTag::HasInlineChildren() const
   case HTMLTag::TAG_UL:
     return false;
   }
+  llvm_unreachable("Unhandled HTMLTag::TagType");
 }
 
 llvm::SmallString<16> HTMLTag::ToString() const {
@@ -162,6 +164,7 @@ llvm::SmallString<16> HTMLTag::ToString(
   case HTMLTag::TAG_LI:
     return llvm::SmallString<16>("li");
   }
+  llvm_unreachable("Unhandled HTMLTag::TagType");
 }
 
 void TextNode::Render(llvm::raw_ostream &OS, int IndentationLevel) {




More information about the cfe-commits mailing list