This MR introduces support for [thread safety annotations,](https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#conditi… currently supported by Clang. The feature is similar to `__WINE_MALLOC` attributes, allowing functions, data members and global variables to be optionally annotated with synchronization details.
As a proof of concept, I have annotated `RTL_CRITICAL_SECTION` and `dlls/ntdll`.
Because the feature was designed as a C++ extension first, a bit of stubbing is required to annotate struct fields about what lock they are guarded by. The macros `WINE_DECLARE_LOCK_FIELD_STUB` and `WINE_DEFINE_LOCK_FIELD_STUB` take care of that. For instance, in `dlls/ntdll/threadpool.c`:
```c
WINE_DECLARE_LOCK_FIELD_STUB(threadpool_group, CRITICAL_SECTION, cs);
struct threadpool_group
{
LONG refcount;
BOOL shutdown;
CRITICAL_SECTION cs;
/* list of group members, locked via .cs */
struct list members __WINE_FIELD_GUARDED_BY(threadpool_group, cs);
};
WINE_DEFINE_LOCK_FIELD_STUB(threadpool_group, CRITICAL_SECTION, cs);
```
Clang will therefore warn if `members` is accessed without holding `cs`.
Note that the analyzer does not support conditional locking. For that reason, functions that hold and release a lock conditionally have been marked with `__WINE_NO_THREAD_SAFETY_ANALYSIS` to pre-empt false positives from Clang.
--
v8: configure: Enable -Wthread-safety-analysis, -Wthread-safety-attributes warnings.
dlls/ntoskrnl.exe: Add thread safety annotations.
dlls/combase: Add thread safety annotations.
dlls/imm32: Add GUARDED_BY attribute to the struct ime's refcount field.
dlls/crypt32: Annotate CRYPT_CollectionAdvanceEnum indicating that the caller should hold the collection store's lock.
dlls/amstream/tests: Disable thread safety analysis for testfilter_wait_state.
dlls/winhttp: Add thread safety annotations.
dlls/mmdevapi: Add thread safety annotations for session_lock and sessions_unlock.
dlls/mfplat: Add thread safety annotations.
dlls/msi: Add thread safety annotations for msiobj_lock and msiobj_unlock.
dlls/xaudio2_7: Add thread safety annotations.
dlls/wmvcore: Add thread safety annotations for async_reader_wait_pts, async_reader_deliver_sample, and callback_thread_run.
dlls/wininet: Disable thread safety annotations for HTTPREQ_ReadFile and HTTPREQ_QueryDataAvailable.
dlls/winegstreamer: Add thread safety annotation for GST_Seeking_SetPositions.
dlls/dwrite: Add thread safety annotations for factory_lock and factory_unlock.
dlls/wined3d: Add thread safety annotations.
lib/vkd3d: Build with WINE_NO_THREAD_SAFETY_ANALYSIS defined.
dlls/d2d1: Add thread safety annotations.
dlls/xaudio2_7: Disable thread safety analysis for IXAudio2Impl_CreateSourceVoice.
dlls/xinput1_3: Add thread safety annotations for controller_lock and controller_unlock.
dlls/ucrtbase/tests: Only release &fp.iobuf->_crit if the previous lock was successful (Clang).
dlls/netio.sys: Add thread safety annotations for lock_sock and unlock_socket.
dlls/msvcirt/tests: Release &sb.lock only if the previous lock was successful (Clang).
dlls/wbemprox: Add thread safety annotations.
libs/strmbase: Annotate BaseRenderer_Receive to indicate the caller needs to hold the underlying filter lock.
dlls/rpcrt4: Add thread safety annotations for AllocateContextHandle, FindContextHandle, ReleaseContextHandle.
dlls/wined3d: Add thread safety annotations for allocator locking helpers.
dlls/mfreadwrite: Indicate calling source_reader_read_sample requires holding &reader->cs.
dlls/mapi32: Add thread safety annotations for GetValue, AddValue, Lock, Unlock.
dlls/kernel32/tests: Add thread safety annotations.
dlls/combase: Add thread safety annotations
programs/services: Add thread safety annotations.
dlls/winmm: Add thread safety annotations.
dlls/vcomp: Add thread safety annotations.
dlls/user32: Add thread safety annotations.
dlls/odbc32: Add thread safety annotations.
dlls/krnl386.exe16: Add thread safety annotations.
dlls/msvcirt: Add thread safety annotations.
dlls/msvcp90: Add thread safety annotations.
dlls/msvcrt: Add thread safety annotations.
dlls/kernelbase: Add thread safety annotations.
include/wine/winbase16: Add thread safety annotations for _Enter/LeaveSysLevel
dlls/kernelbase: Release console_section in case of an allocation failure in alloc_console.
include/winbase.h: Add thread safety annotations for Enter/LeaveCriticalSection, SleepConditionVariableCS and TryEnterCriticalSection.
dlls/ntdll: Add thread safety annotations.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6623
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57370
--
v3: winex11: Always generate ConfigureNotify events for embedded windows.
winex11: Generate ConfigureNotify events for the children tree.
winex11: Avoid overriding previously received ConfigureNotify events.
winex11: Retrieve the HWND for the host window's child window.
winex11: Introduce a new host_window_send_configure_events helper.
winex11: Reset the window relative position when it gets reparented.
winex11: Reset embedded window position to 0x0 before docking it.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6815
I think the remaining question here is if we want to remove script/lang lookup logic entirely, or instead prioritize. @sgwaki, any idea if it's possible to test that? Testing manually is fine. To be clear, test font should have at least two differing vert features, with second feature being testable with specific script/lang pair, if that is possible to achieve with plain gdi API at all.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5633#note_87482
Please don't constantly rebase your MR, it's a waste of CI resources.
As far as I can tell it hasn't been confirmed that this actually fixes anything, and it seems unlikely that it would be useful without applying the deltas.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5523#note_87478