Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22698

clang-format can produce an indentation of the uassert macro that fools the zero-code checker

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.2
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
    • Fully Compatible
    • ALL
    • v3.2
    • Integration 10 (02/22/16)

      The zero code checker doesn't catch this code. The code can also be a duplicate of another code, it still doesn't catch it.

      Example file:

      #include "mongo/util/assert_util.h"                                                                                                                                                                                
                                                                                                                                                                                                                         
      namespace mongo {                                                                                                                                                                                                  
                                                                                                                                                                                                                         
      void test() {                                                                                                                                                                                                      
          bool x = true;                                                                                                                                                                                                 
          if (x) {                                                                                                                                                                                                       
              uassert(                                                                                                                                                                                                   
                  0,                                                                                                                                                                                                 
                  "String that is exactly the right amount of characters to produce this indentation.",                                                                                                                  
                  x);                                                                                                                                                                                                    
          }                                                                                                                                                                                                              
      }                                                                                                                                                                                                                  
      }             
      

            Assignee:
            adam.midvidy Adam Midvidy
            Reporter:
            adam.midvidy Adam Midvidy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: