From: Bruno Haible Date: Sun, 15 May 2022 11:25:46 +0000 (+0200) Subject: string, wchar: Fix compilation error on MSVC (regression 2021-09-07). X-Git-Tag: v1.0~2289 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4bc2b6f67259e3fb54d21d3b93e7cab12161f7fd;p=gnulib.git string, wchar: Fix compilation error on MSVC (regression 2021-09-07). * lib/string.in.h (free): For MSVC, add the dllimport specification if the MSVC headers have it. * lib/wchar.in.h (free): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 42f7e2cc54..2d98fca938 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-05-15 Bruno Haible + + string, wchar: Fix compilation error on MSVC (regression 2021-09-07). + * lib/string.in.h (free): For MSVC, add the dllimport specification if + the MSVC headers have it. + * lib/wchar.in.h (free): Likewise. + 2022-05-14 Bruno Haible glob tests: Fix a warning (regression from 2022-03-23). diff --git a/lib/string.in.h b/lib/string.in.h index 33160b2525..3996da9fcb 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -122,8 +122,12 @@ _GL_EXTERN_C void rpl_free (void *); # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else -# if defined _MSC_VER -_GL_EXTERN_C void __cdecl free (void *); +# if defined _MSC_VER && !defined free +_GL_EXTERN_C +# if defined _DLL + __declspec (dllimport) +# endif + void __cdecl free (void *); # else # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) _GL_EXTERN_C void free (void *) throw (); @@ -133,8 +137,12 @@ _GL_EXTERN_C void free (void *); # endif # endif #else -# if defined _MSC_VER -_GL_EXTERN_C void __cdecl free (void *); +# if defined _MSC_VER && !defined free +_GL_EXTERN_C +# if defined _DLL + __declspec (dllimport) +# endif + void __cdecl free (void *); # else # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) _GL_EXTERN_C void free (void *) throw (); diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 0d5c0b7abe..835ddbe659 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -185,8 +185,12 @@ _GL_EXTERN_C void rpl_free (void *); # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else -# if defined _MSC_VER -_GL_EXTERN_C void __cdecl free (void *); +# if defined _MSC_VER && !defined free +_GL_EXTERN_C +# if defined _DLL + __declspec (dllimport) +# endif + void __cdecl free (void *); # else # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) _GL_EXTERN_C void free (void *) throw (); @@ -196,8 +200,12 @@ _GL_EXTERN_C void free (void *); # endif # endif #else -# if defined _MSC_VER -_GL_EXTERN_C void __cdecl free (void *); +# if defined _MSC_VER && !defined free +_GL_EXTERN_C +# if defined _DLL + __declspec (dllimport) +# endif + void __cdecl free (void *); # else # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) _GL_EXTERN_C void free (void *) throw ();