Skip to content

Conversation

@kevinAlbs
Copy link
Collaborator

@kevinAlbs kevinAlbs commented Dec 15, 2025

See CDRIVER-6175. Intended to remove an unnecessary CXX= from the handshake when a C++ compiler is not checked.

A wrapping driver may configure an empty string to indicate no check occurred. Prior to this PR that results in a platform string like:

                                                        vvvv
cfg=0x06235e88e9 posix=200809 stdc=199901 CC=GCC 11.4.0 CXX= CFLAGS=\"\" LDFLAGS=\"\"
                                                        ^^^^

After this PR:

cfg=0x06235e88e9 posix=200809 stdc=199901 CC=GCC 11.4.0 CFLAGS=\"\" LDFLAGS=\"\"

@kevinAlbs kevinAlbs marked this pull request as ready for review December 16, 2025 16:54
@kevinAlbs kevinAlbs requested a review from a team as a code owner December 16, 2025 16:54
@kevinAlbs kevinAlbs requested a review from eramongodb December 16, 2025 16:54
#endif

mcommon_string_append(&append, " CXX=" MONGOC_CXX_COMPILER_ID);
if (0 != strlen(MONGOC_CXX_COMPILER_ID)) {
Copy link
Contributor

@eramongodb eramongodb Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior code permitted MONGOC_CXX_COMPILER_ID to be undefined:

" CXX=" MONGOC_CXX_COMPILER_ID // -> " CXX="

This call to strlen() must either support a similar pattern:

if (0 != strlen("" MONGOC_CXX_COMPILER_ID)) { ... }

or be guarded by an ifdef:

#ifdef MONGOC_CXX_COMPILER_ID
   if (0 != strlen(MONGOC_CXX_COMPILER_ID)) { ... }
#endif

Copy link
Collaborator Author

@kevinAlbs kevinAlbs Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested. I expect MONGOC_CXX_COMPILER_ID is always defined after configuring mongoc-config-private.h.in. But this might avoid the risk of breaking consumers if they bring-their-own mongoc-config-private.h.

MONGOC_CXX_COMPILER_VERSION is updated for consistency.

May not be strictly needed. But might avoid the risk of breaking a user building with their own mongoc-config-private.h
@kevinAlbs kevinAlbs requested a review from eramongodb December 16, 2025 18:05
@kevinAlbs kevinAlbs merged commit 7377443 into mongodb:master Dec 17, 2025
43 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants