[PATCH] D91895: [Clang] avoid -Wimplicit-fallthrough for fallthrough to break

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 20 16:48:30 PST 2020


nickdesaulniers added a comment.

Testing this on the kernel with `-Wimplicit-fallthrough`, there's some additional cases that are still warning:

  // mm/vmscan.c
  1371         mapping = page_mapping(page);                                                                                                                                                                                                 
  1372       case PAGE_CLEAN: // -Wimplicit-fallthrough                                                                                                                                                                                                               
  1373         ; /* try to free the page below */                                                                                                                                                                                            
  1374       } 

  // fs/nfs/nfs4client.c
   611       nfs4_schedule_path_down_recovery(pos);                                                                                                                                                                                          
   612     default: // -Wimplicit-fallthrough                                                                                                                                                                                                                         
   613       goto out;

  // drivers/hid/usbhid/hid-core.c
   490   case -ESHUTDOWN:  /* unplug */                                                                                                                                                                                                      
   491     unplug = 1; 
   492   case -EILSEQ:   /* protocol error or unplug */ // -Wimplicit-fallthrough...how?!                                                                                                                                     
   493   case -EPROTO:   /* protocol error or unplug */                                                                                                                                                                                      
   494   case -ECONNRESET: /* unlink */                                                                                                                                                                                                      
   495   case -ENOENT:                                                                                                                                                                                                                       
   496   case -EPIPE:    /* report not available */                                                                                                                                                                                          
   497     break;   

  // security/keys/process_keys.c
  782       default:                                                                                                                                                                                                                         
  783         if (need_perm != KEY_AUTHTOKEN_OVERRIDE &&                                                                                                                                                                                     
  784             need_perm != KEY_DEFER_PERM_CHECK)                                                                                                                                                                                         
  785           goto invalid_key;                                                                                                                                                                                                            
  786       case 0: // -Wimplicit-fallthrough...how?!                                                                                                                                                                                      
  787         break;                                                                                                                                                                                                                         
  788       }    

Ah, I think I need to reconsider the case that there is more than one successor, or at least differentiate which successor is the fallthrough block, rather than only checking blocks that have 1 successor.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91895/new/

https://reviews.llvm.org/D91895



More information about the cfe-commits mailing list