From 5f8fa2260278618b164272e9d9ee15b39704b30e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 11 Jun 2024 20:44:18 +0200 Subject: build: resolve a -Wunused-function compiler warning (#308) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit posixSocket.cpp:67:7: warning: ‘char* {anonymous}::vmime_strerror_r_result(int, char*)’ defined but not used [-Wunused-function] 67 | char* vmime_strerror_r_result(int /* res */, char* buf) { It is to be expected that one of the two r_result functions is going unused, depending on whichever platform we are currently building on. --- src/vmime/platforms/posix/posixSocket.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vmime/platforms/posix/posixSocket.cpp b/src/vmime/platforms/posix/posixSocket.cpp index aec6a83e..c0ce0cfa 100644 --- a/src/vmime/platforms/posix/posixSocket.cpp +++ b/src/vmime/platforms/posix/posixSocket.cpp @@ -64,14 +64,20 @@ namespace { -char* vmime_strerror_r_result(int /* res */, char* buf) { +#ifdef __GNUC__ +# define GNU_UNUSED [[gnu::unused]] +#else +# define GNU_UNUSED +#endif + +GNU_UNUSED char* vmime_strerror_r_result(int /* res */, char* buf) { // XSI-compliant prototype: // int strerror_r(int errnum, char *buf, size_t buflen); return buf; } -char* vmime_strerror_r_result(char* res, char* /* buf */) { +GNU_UNUSED char* vmime_strerror_r_result(char* res, char* /* buf */) { // GNU-specific prototype: // char *strerror_r(int errnum, char *buf, size_t buflen); -- cgit v1.2.3