On 2017/4/3 0:54, David Grayson wrote:
On April 2, 2017 2:55:35 AM GMT+02:00, David Grayson <
davidegray...@gmail.com> wrote:
In MSYS2 and in my own compilation of a mingw-w64 GCC 6.3.0 toolchain,
strsafe.h was producing tons of warnings when included because it was
declaring its functions as inline but then not defining them.

I think the right solution is to change "__inline" to "__CRT_INLINE" so
I
have attached a patch for doing that.  I could have just removed the
"__inline" but it seems like mingw-w64 has a feature of making all its
functions be inline and I was not sure, but probably the right way to
do
that is to use __CRT_INLINE.

I'm afraid it isn't the correct fix. If the compiler says it is declared and not defined, then it is declared and not defined.

The inline definitions are provided when `__STRSAFE__NO_INLINE` is not defined (see line 159 and 873), that is, when `__CRT__NO_INLINE` is defined and `__CRT_STRSAFE_IMPL` is not defined (see line 15). However, we fail to keep the consistency between these declarations and definitions. These functions are declared as inline only when `__CRT_STRSAFE_IMPL` is not defined. If only `__CRT__NO_INLINE` is defined, these functions would be declared as inline while their inline definitions will not be provided. Hence the warning.

The proper way to fix this problem is checking the same condition on lines 84, 94 and lines 159, 175, 873, etc. I have attached a new patch for this issue. Please test.

--
Best regards,
LH_Mouse





From f2f652c023ad1320f69bd7d5f0d5c47376056869 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mo...@126.com>
Date: Mon, 3 Apr 2017 02:00:15 +0800
Subject: [PATCH] include/strsafe.h: Fix warning 'inline function declared but
 never defined'.

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/35763431/
Signed-off-by: Liu Hao <lh_mo...@126.com>
---
 mingw-w64-headers/include/strsafe.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/include/strsafe.h b/mingw-w64-headers/include/strsafe.h
index 36c7796c..66b5336f 100644
--- a/mingw-w64-headers/include/strsafe.h
+++ b/mingw-w64-headers/include/strsafe.h
@@ -81,7 +81,7 @@ typedef __LONG32 HRESULT;
 #endif
 #endif

-#ifndef __CRT_STRSAFE_IMPL
+#ifndef __STRSAFE__NO_INLINE
 #define STRSAFEAPI _STRSAFE_EXTERN_C __inline HRESULT WINAPI
 /* Variadic functions can't be __stdcall.  */
 #define STRSAFEAPIV _STRSAFE_EXTERN_C __inline HRESULT
@@ -91,7 +91,7 @@ typedef __LONG32 HRESULT;
 #define STRSAFEAPIV HRESULT
 #endif

-#ifndef __CRT_STRSAFE_IMPL
+#ifndef __STRSAFE__NO_INLINE
 #define STRSAFE_INLINE_API _STRSAFE_EXTERN_C __CRT_INLINE HRESULT WINAPI
 #else
 #define STRSAFE_INLINE_API HRESULT WINAPI
--
2.12.1


From f2f652c023ad1320f69bd7d5f0d5c47376056869 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mo...@126.com>
Date: Mon, 3 Apr 2017 02:00:15 +0800
Subject: [PATCH] include/strsafe.h: Fix warning 'inline function declared but
 never defined'.

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/35763431/
Signed-off-by: Liu Hao <lh_mo...@126.com>
---
 mingw-w64-headers/include/strsafe.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/include/strsafe.h 
b/mingw-w64-headers/include/strsafe.h
index 36c7796c..66b5336f 100644
--- a/mingw-w64-headers/include/strsafe.h
+++ b/mingw-w64-headers/include/strsafe.h
@@ -81,7 +81,7 @@ typedef __LONG32 HRESULT;
 #endif
 #endif
 
-#ifndef __CRT_STRSAFE_IMPL
+#ifndef __STRSAFE__NO_INLINE
 #define STRSAFEAPI _STRSAFE_EXTERN_C __inline HRESULT WINAPI
 /* Variadic functions can't be __stdcall.  */
 #define STRSAFEAPIV _STRSAFE_EXTERN_C __inline HRESULT
@@ -91,7 +91,7 @@ typedef __LONG32 HRESULT;
 #define STRSAFEAPIV HRESULT
 #endif
 
-#ifndef __CRT_STRSAFE_IMPL
+#ifndef __STRSAFE__NO_INLINE
 #define STRSAFE_INLINE_API _STRSAFE_EXTERN_C __CRT_INLINE HRESULT WINAPI
 #else
 #define STRSAFE_INLINE_API HRESULT WINAPI
-- 
2.12.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to