[SERVER-43010] remove DEV and MONGO_DEV `if`-macros Created: 23/Aug/19  Updated: 29/Oct/23  Resolved: 23/Aug/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Dev Tools 2019-08-26
Participants:

 Description   

These macros read like statement attributes but are really flow control.

They have the potential to "falsely" bind to following else statements, and clang-format can't see through it.

The hidden if condition can't combine with other conditions using && and ||, so it ends up in some cases making code a little worse.

`DEV` is too broad a namespace. Indeed we touch third-party source using it as an enum value.

It could be confused with "DEVice".

It isn't clear that DEVelopment build maps 1:1 to a "debug" build. Meaning is unclear.

As an alternative, we can inline it where it appears, writing `if (kDebugBuild)` and we will have more conventional code. The sugar of the DEV macro isn't valuable enough to justify its risks.

`mongo::kDebugBuild` is a conventional constexpr bool variable.



 Comments   
Comment by Githook User [ 23/Aug/19 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-43010 remove DEV and MONGO_DEV macros
Branch: master
https://github.com/mongodb/mongo/commit/441871aa17a4c77175c8c6d6c8ac94eadecbfd33

Comment by Githook User [ 23/Aug/19 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-43010 remove DEV and MONGO_DEV macros
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/2c0940c4fb86b0661391f828cdce0cafc55aa57a

Comment by Billy Donahue [ 23/Aug/19 ]

https://mongodbcr.appspot.com/495100001/

Comment by Andrew Morrow (Inactive) [ 23/Aug/19 ]

Yeah, these macros have never carried their weight, in my opinion. It looks like there are less than 40 of them, so it should be a trivial fixup?

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