[PATCH] D56006: [AST] Fix a -Wimplicit-fallthrough warning in ScanfFormatString.cpp

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 21 07:46:08 PST 2018


riccibruno created this revision.
riccibruno added a reviewer: hans.
riccibruno added a project: clang.
Herald added a subscriber: cfe-commits.

This is showing up with some bots
(eg http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/19061/steps/build%20stage%201/logs/warnings%20%284%29)

I am putting this for review since I am not familiar with this code and am not
sure whether adding `llvm_unreachable` is better than adding a default case
covering the invalid cases, as is done a few lines below.


Repository:
  rC Clang

https://reviews.llvm.org/D56006

Files:
  lib/AST/ScanfFormatString.cpp


Index: lib/AST/ScanfFormatString.cpp
===================================================================
--- lib/AST/ScanfFormatString.cpp
+++ lib/AST/ScanfFormatString.cpp
@@ -264,6 +264,7 @@
         case LengthModifier::AsWide:
           return ArgType::Invalid();
       }
+      llvm_unreachable("Unexpected length modifier!");
 
     // Unsigned int.
     case ConversionSpecifier::oArg:
@@ -303,6 +304,7 @@
         case LengthModifier::AsWide:
           return ArgType::Invalid();
       }
+      llvm_unreachable("Unexpected length modifier!");
 
     // Float.
     case ConversionSpecifier::aArg:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56006.179287.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181221/c4f108ca/attachment.bin>


More information about the cfe-commits mailing list