[SERVER-22698] clang-format can produce an indentation of the uassert macro that fools the zero-code checker Created: 17/Feb/16  Updated: 17/Jan/17  Resolved: 17/Feb/16

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.3.2

Type: Bug Priority: Major - P3
Reporter: Adam Midvidy Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: bkp, clang-format
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-18979 Duplicate uassert & fassert codes Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.2
Sprint: Integration 10 (02/22/16)
Participants:

 Description   

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);                                                                                                                                                                                                    
    }                                                                                                                                                                                                              
}                                                                                                                                                                                                                  
}             



 Comments   
Comment by Githook User [ 17/Feb/16 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-22698 fix duplicate error codes caused by broken errorcodes.py
Branch: master
https://github.com/mongodb/mongo/commit/b8d4f01bb6f61284378be31919f9e4b2493a79fc

Comment by Mathias Stearn [ 17/Feb/16 ]

FYI, there is at least one duplicate error code due to this: 34403. Luckily, both instances are in BenchRun so this case isn't a big deal, but there may be other more problematic duplicates.

Generated at Thu Feb 08 04:01:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.