simon-git: putty (main): Jacob Nevins

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Fri Sep 2 16:33:52 BST 2022


TL;DR:
  c8b66101 Thread-local support for more Windows toolchains.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Jacob Nevins <jacobn at chiark.greenend.org.uk>
Date:           2022-09-02 16:33:52

commit c8b66101ee57f1932498861a418be033a181d1dd
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c8b66101ee57f1932498861a418be033a181d1dd;hp=e6f9df92085d9f5679feff8cec6f44588fb44de0
Author: Jacob Nevins <jacobn at chiark.greenend.org.uk>
Date:   Fri Sep 2 16:09:40 2022 +0100

    Thread-local support for more Windows toolchains.
    
    Use of thread-local storage on Windows (introduced recently in
    69e8d471d1) could cause a -Wattributes warning in mingw-w64 builds,
    since that toolchain doesn't understand __declspec(thread).
    
    Define a portability macro THREADLOCAL, which should resolve to
    something appropriate for at least:
     - MSVC, which understands the Microsoft syntax __declspec(thread);
     - GCC (e.g., mingw-w64) which understands the GNU syntax __thread
       (GCC only implements __declspec() to the extent of understanding the
       arguments 'dllexport' and 'dllimport');
     - Clang, which supports both syntaxes.
    
    (It's possible there's some more obscure Windows toolchain which will
    now hit the #error as a result of this change.)
    
    I haven't attempted to try to detect and use the C11 syntax
    'thread_local'. And this is all still Windows-only, since that's all we
    need for now and it avoids opening the can of worms that is TLS on other
    platforms.
    
    (I considered delegating all this to cmake, but as well as being fiddly,
    it seems even the latest versions of cmake don't know about thread-local
    storage for C, as opposed to C++ (cxx_thread_local).)

 windows/platform.h             | 8 ++++++++
 windows/utils/shinydialogbox.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)



More information about the tartarus-commits mailing list