changeset 27643:517daf1a6e5b v8.2.4347

patch 8.2.4347: in some build setups UNUSED is not defined Commit: https://github.com/vim/vim/commit/bd89d4406327d3a30517443a4a518f49ebc99368 Author: ola.soder@axis.com <ola.soder@axis.com> Date: Fri Feb 11 19:27:55 2022 +0000 patch 8.2.4347: in some build setups UNUSED is not defined Problem: In some build setups UNUSED is not defined. Solution: Change the logic of how UNUSED is defined. (Ola S?der, closes #9734)
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Feb 2022 20:30:03 +0100
parents 46d8185de1e9
children 666f8cbb90dd
files src/version.c src/vim.h
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4347,
+/**/
     4346,
 /**/
     4345,
--- a/src/vim.h
+++ b/src/vim.h
@@ -245,12 +245,19 @@
 
 // Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
 // can be used to check for mistakes.
-#if defined(HAVE_ATTRIBUTE_UNUSED) || defined(__MINGW32__)
-# if !defined(UNUSED)
+#ifndef UNUSED
+# if defined(HAVE_ATTRIBUTE_UNUSED) || defined(__MINGW32__)
 #  define UNUSED __attribute__((unused))
+# else
+#  if defined __has_attribute
+#   if __has_attribute(unused)
+#    define UNUSED __attribute__((unused))
+#   endif
+#  endif
 # endif
-#else
-# define UNUSED
+# ifndef UNUSED
+#  define UNUSED
+# endif
 #endif
 
 // Used to check for "sun", "__sun" is used by newer compilers.