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)
diff --git a/src/vim.h b/src/vim.h
index 166edf5..4f95bb4 100644
--- 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.