SERVER-98435 Rename MONGO_MOD_PUB -> MONGO_MOD_PUBLIC (#42272)

GitOrigin-RevId: 1588849c60a72fb542ad88d7faefe8458aed5341
This commit is contained in:
Mathias Stearn 2025-10-07 21:28:25 +02:00 committed by MongoDB Bot
parent 40c68d00b1
commit 662bda6105
7 changed files with 18 additions and 14 deletions

View File

@ -1335,7 +1335,7 @@ class ParserContext(object):
self._add_node_error( self._add_node_error(
node, node,
ERROR_ID_BAD_VISIBILITY, ERROR_ID_BAD_VISIBILITY,
f"Bad visibility value '{mod_visibility}', only pub, pub_for_technical_reasons, private, file_private, needs_replacement, and use_replacement(...) are accepted", f"Bad visibility value '{mod_visibility}', only public, public_for_technical_reasons, private, file_private, needs_replacement, and use_replacement(...) are accepted",
) )

View File

@ -225,7 +225,7 @@ def _parse_config_global(ctxt, node):
_mod_visibility_pattern = re.compile( _mod_visibility_pattern = re.compile(
"(pub|pub_for_technical_reasons|private|file_private|needs_replacement|use_replacement\(.+\))" "(pub|public|public_for_technical_reasons|private|file_private|needs_replacement|use_replacement\(.+\))"
) )

View File

@ -108,8 +108,9 @@ description: Schema for IDL files in the mongo codebase.
oneOf: oneOf:
- type: string - type: string
enum: enum:
- pub - pub # deprecated alias for public
- pub_for_technical_reasons - public
- public_for_technical_reasons
- private - private
- file_private - file_private
- needs_replacement - needs_replacement

View File

@ -92,11 +92,11 @@ To make an API or class available for use by other modules, add a
tag to its header declaration. tag to its header declaration.
``` ```
class MONGO_MOD_PUB Foo { class MONGO_MOD_PUBLIC Foo {
}; };
MONGO_MOD_PUB int foo(); MONGO_MOD_PUBLIC int foo();
``` ```
Availability specification can also be done at the namespace level. Availability specification can also be done at the namespace level.

View File

@ -119,7 +119,7 @@ class LegacyStrictGenerator;
Code With Scope: <total size><String><Object> Code With Scope: <total size><String><Object>
\endcode \endcode
*/ */
class MONGO_MOD_PUB BSONObj { class MONGO_MOD_PUBLIC BSONObj {
public: public:
struct DefaultSizeTrait { struct DefaultSizeTrait {
constexpr static int MaxSize = BSONObjMaxInternalSize; constexpr static int MaxSize = BSONObjMaxInternalSize;

View File

@ -30,7 +30,7 @@
global: global:
cpp_namespace: "mongo::repl" cpp_namespace: "mongo::repl"
mod_visibility: pub_for_technical_reasons mod_visibility: public_for_technical_reasons
imports: imports:
- "mongo/db/basic_types.idl" - "mongo/db/basic_types.idl"

View File

@ -52,7 +52,10 @@
* default all hierarchies are closed within their module unless explicitly marked as open. * default all hierarchies are closed within their module unless explicitly marked as open.
* See MONGO_MOD_OPEN below. * See MONGO_MOD_OPEN below.
*/ */
#define MONGO_MOD_PUB MONGO_MOD_ATTR_(public) #define MONGO_MOD_PUBLIC MONGO_MOD_ATTR_(public)
/// Deprecated alias for MONGO_MOD_PUBLIC. TODO: All usages will be converted soon.
#define MONGO_MOD_PUB MONGO_MOD_PUBLIC
/** /**
* Marks a class as open and everything inside as public to other modules. * Marks a class as open and everything inside as public to other modules.
@ -61,8 +64,8 @@
* levels. * levels.
* *
* If we later decide we do not like this distinction, we can easily just sed this macro away * If we later decide we do not like this distinction, we can easily just sed this macro away
* and use MONGO_MOD_PUB everywhere. But it will be easier to start with the distinction than to add * and use MONGO_MOD_PUBLIC everywhere. But it will be easier to start with the distinction than to
* it later. * add it later.
* *
* NOTE: unlike other markers openness is *not* applied recursively, so each type that should * NOTE: unlike other markers openness is *not* applied recursively, so each type that should
* support external subclasses must be separately marked as open. * support external subclasses must be separately marked as open.
@ -72,7 +75,7 @@
/** /**
* Marks a declaration which the module owner would prefer to be * Marks a declaration which the module owner would prefer to be
* private, but for which there is currently no good alternative * private, but for which there is currently no good alternative
* for out-of-module usage. Allows external usage like MONGO_MOD_PUB, * for out-of-module usage. Allows external usage like MONGO_MOD_PUBLIC,
* but gives a warning to the module owner. * but gives a warning to the module owner.
*/ */
#define MONGO_MOD_NEEDS_REPLACEMENT MONGO_MOD_ATTR_(needs_replacement) #define MONGO_MOD_NEEDS_REPLACEMENT MONGO_MOD_ATTR_(needs_replacement)
@ -80,7 +83,7 @@
* Marks a declaration which the module owner would prefer to be * Marks a declaration which the module owner would prefer to be
* private, but for which there are historical uses outside the * private, but for which there are historical uses outside the
* module which haven't been cleaned up yet. Allows external usage * module which haven't been cleaned up yet. Allows external usage
* like MONGO_MOD_PUB, but gives a warning to each caller for usage * like MONGO_MOD_PUBLIC, but gives a warning to each caller for usage
* outside the module. * outside the module.
*/ */
#define MONGO_MOD_USE_REPLACEMENT(replacement) MONGO_MOD_ATTR_(use_replacement::replacement) #define MONGO_MOD_USE_REPLACEMENT(replacement) MONGO_MOD_ATTR_(use_replacement::replacement)
@ -92,7 +95,7 @@
* currently need to be public, even if they aren't directly used externally. * currently need to be public, even if they aren't directly used externally.
* In almost all cases, MONGO_MOD_NEEDS_REPLACEMENT should be used instead. * In almost all cases, MONGO_MOD_NEEDS_REPLACEMENT should be used instead.
*/ */
#define MONGO_MOD_PUB_FOR_TECHNICAL_REASONS MONGO_MOD_ATTR_(public) #define MONGO_MOD_PUBLIC_FOR_TECHNICAL_REASONS MONGO_MOD_ATTR_(public)
/** Marks a declaration and everything inside as private from other modules */ /** Marks a declaration and everything inside as private from other modules */
#define MONGO_MOD_PRIVATE MONGO_MOD_ATTR_(private) #define MONGO_MOD_PRIVATE MONGO_MOD_ATTR_(private)