diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2021-09-20 23:27:51 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-21 00:07:27 +0000 |
commit | 6ff19433eb6f8dba381c6736a364b1967ba43541 (patch) | |
tree | 1bd33b8672534daf118441c67280b1bfc217ff93 /buildscripts | |
parent | 5e28775ebde238a628532dc5dd947b55b815310b (diff) | |
download | mongo-6ff19433eb6f8dba381c6736a364b1967ba43541.tar.gz |
SERVER-60022 global std::optional -> boost::optional
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/linter/simplecpplint.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/buildscripts/linter/simplecpplint.py b/buildscripts/linter/simplecpplint.py index 11f7056d8bc..7f20d7b11d6 100644 --- a/buildscripts/linter/simplecpplint.py +++ b/buildscripts/linter/simplecpplint.py @@ -58,6 +58,7 @@ _RE_VOLATILE = re.compile('[^_]volatile') _RE_MUTEX = re.compile('[ ({,]stdx?::mutex[ ({]') _RE_ASSERT = re.compile(r'\bassert\s*\(') _RE_UNSTRUCTURED_LOG = re.compile(r'\blogd\s*\(') +_RE_STD_OPTIONAL = re.compile(r'\bstd::optional\b') _RE_GENERIC_FCV_COMMENT = re.compile(r'\(Generic FCV reference\):') GENERIC_FCV = [ @@ -143,6 +144,7 @@ class Linter: self._check_for_mongo_unstructured_log(linenum) self._check_for_mongo_config_header(linenum) self._check_for_ctype(linenum) + self._check_for_std_optional(linenum) # Relax the rule of commenting generic FCV references for files directly related to FCV # implementations. @@ -246,6 +248,12 @@ class Linter: self._error(linenum, 'mongodb/ctype', 'Use of prohibited <ctype.h> or <cctype> header, use "mongo/util/ctype.h"') + def _check_for_std_optional(self, linenum): + line = self.clean_lines[linenum] + if _RE_STD_OPTIONAL.search(line): + self._error(linenum, 'mongodb/stdoptional', + 'Use of std::optional, use boost::optional instead.') + def _license_error(self, linenum, msg, category='legal/license'): style_url = 'https://github.com/mongodb/mongo/wiki/Server-Code-Style' self._error(linenum, category, '{} See {}'.format(msg, style_url)) |