[SERVER-79655] missing winnt.h include in platform/pause.h Created: 03/Aug/23  Updated: 08/Aug/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

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

Issue Links:
Related
is related to SERVER-79865 Upgrade Win32 spinlock.h implementati... Backlog
Assigned Teams:
Service Arch
Participants:

 Description   

I went to use this macro and couldn't figure out how to get it to work. It doesn't include any headers, so the compiler reports that the reference to YieldProcessor is invalid.

https://github.com/10gen/mongo/blob/b4a8ce1d8149c4a1ca3cf5efc02ca60c2b40e8b7/src/mongo/platform/pause.h#L84

// On Windows, use the winnt.h YieldProcessor macro
#define MONGO_YIELD_CORE_FOR_SMT() YieldProcessor()

I've tried a few things.
Adding a #include <winnt.h> above it.

This yields a #error complaint that there's "no target architecture".

https://parsley.mongodb.com/evergreen/mongodb_mongo_master_windows_compile_required_compile_dist_test_patch_eba65446f5d9279b65041e15ce7dd8c1138f5537_64cb1715d6d80a4b794e31aa_23_08_03_02_56_14/0/task?bookmarks=9965

It looks like this could be due to missing windows.h? So I #include <windows.h> above <winnt.h> and then lots of code fails to compile due to usage of min() and max(), etc.

Someone with more Windows experience could figure this out.



 Comments   
Comment by Billy Donahue [ 03/Aug/23 ]

There's a /FImongo/platform/basic.h in the failed command, so I'm surprised by this failure. That header looks like it should be setting up the whole Win32 API.

[2023/08/03 03:49:24.618] cl /Fobuild\cached\mongo\db\process_health\dns_health_observer.obj /c src\mongo\db\process_health\dns_health_observer.cpp /TP /nologo /WX /FImongo/platform/basic.h /fp:strict /EHsc /W3 /wd4068 /wd4244 /wd4267 /wd4290 /wd4351 /wd4355 /wd4373 /wd4800 /wd4251 /wd4291 /we4013 /we4099 /we4930 /errorReport:none /MD /O2 /Oy- /bigobj /utf-8 /permissive- /Zc:__cplusplus /Zc:sizedDealloc /volatile:iso /diagnostics:caret /std:c++20 /Gw /Gy /Zc:inline /DSAFEINT_USE_INTRINSICS=0 /DPCRE2_STATIC /DNDEBUG /DBOOST_ALL_NO_LIB /D_UNICODE /DUNICODE /D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /D_ENABLE_EXTENDED_ALIGNED_STORAGE /D_SCL_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0A00 /DBOOST_USE_WINAPI_VERSION=0x0A00 /DNTDDI_VERSION=0x0A000000 /DABSL_FORCE_ALIGNED_ACCESS /DBOOST_ENABLE_ASSERT_DEBUG_HANDLER /DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF /DBOOST_LOG_NO_SHORTHAND_NAMES /DBOOST_LOG_USE_NATIVE_SYSLOG /DBOOST_LOG_WITHOUT_THREAD_ATTR /DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS /DBOOST_SYSTEM_NO_DEPRECATED /DBOOST_THREAD_USES_DATETIME /DBOOST_THREAD_VERSION=5 /Isrc\third_party\s2 /Isrc\third_party\libstemmer_c\include /Isrc\third_party\SafeInt /Isrc\third_party\murmurhash3 /Isrc\third_party\immer\dist /Isrc\third_party\fmt\dist\include /Isrc\third_party\boost /Isrc\third_party\abseil-cpp\dist /IC:\sasl\include /Ibuild\cached /Isrc /Z7

Generated at Thu Feb 08 06:41:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.