r365174 - Silence gcc warning "control reaches end of non-void function" [NFCI]

Mikael Holmen via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 4 23:12:25 PDT 2019


Author: uabelho
Date: Thu Jul  4 23:12:24 2019
New Revision: 365174

URL: http://llvm.org/viewvc/llvm-project?rev=365174&view=rev
Log:
Silence gcc warning "control reaches end of non-void function" [NFCI]

Without this fix gcc (7.4) complains with

 /data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp: In member function 'std::__cxx11::string {anonymous}::CGObjCCommonMac::GetSectionName(llvm::StringRef, llvm::StringRef)':
 /data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp:4944:1: error: control reaches end of non-void function [-Werror=return-type]
  }
  ^

All values in the ObjectFormatType enum are currently handled in the switch
but gcc complains anyway.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=365174&r1=365173&r2=365174&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Jul  4 23:12:24 2019
@@ -4941,6 +4941,8 @@ std::string CGObjCCommonMac::GetSectionN
     llvm::report_fatal_error(
         "Objective-C support is unimplemented for object file format.");
   }
+
+  llvm_unreachable("Unhandled llvm::Triple::ObjectFormatType enum");
 }
 
 /// EmitImageInfo - Emit the image info marker used to encode some module




More information about the cfe-commits mailing list