compat/posix.h: clean up GIT_GNUC_PREREQ() and UNUSED
Fix the preprocessor indentation of the GIT_GNUC_PREREQ() and UNUSED macros according to the CodingGuidelines, without changing their behavior. Adjust the spelling in the GIT_GNUC_PREREQ() comment block. Signed-off-by: Dominik Loidolt <dominik.loidolt@univie.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dominik Loidolt committed
Jun 13, 2026 at 14:27 UTC
ffd45926dcb18337b7897bd96d8b1b14acec2359
1 file changed
+8
-9
compat/posix.h
+8
-9
@@ -5,11 +5,10 @@
5
6
/*
7
* Derived from Linux "Features Test Macro" header
8
- * Convenience macros to test the versions of gcc (or
9
- * a compatible compiler).
8
+ * Convenience macros to test the versions of GCC (or a compatible compiler).
9
* Use them like this:
10
* #if GIT_GNUC_PREREQ (2,8)
12
- * ... code requiring gcc 2.8 or later ...
11
+ * ... code requiring GCC 2.8 or later ...
12
* #endif
13
*
14
* Note that Clang and other compilers define __GNUC__ for compatibility; use
@@ -17,12 +16,12 @@
16
*
17
* This macro of course is not part of POSIX, but we need it for the UNUSED
18
* macro which is used by some of our POSIX compatibility wrappers.
20
-*/
19
+ */
20
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
21
# define GIT_GNUC_PREREQ(maj, min) \
22
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
23
#else
25
- #define GIT_GNUC_PREREQ(maj, min) 0
24
+# define GIT_GNUC_PREREQ(maj, min) 0
25
#endif
26
27
/* Similar for Clang. */
@@ -48,13 +47,13 @@
47
* compilation, consider using MAYBE_UNUSED instead.
48
*/
49
#if GIT_GNUC_PREREQ(4, 5) || GIT_CLANG_PREREQ(2, 9)
51
-#define UNUSED __attribute__((unused)) \
52
- __attribute__((deprecated ("parameter declared as UNUSED")))
50
+# define UNUSED __attribute__((unused)) \
51
+ __attribute__((deprecated("parameter declared as UNUSED")))
52
#elif defined(__GNUC__)
54
-#define UNUSED __attribute__((unused)) \
53
+# define UNUSED __attribute__((unused)) \
54
__attribute__((deprecated))
55
#else
57
-#define UNUSED
56
+# define UNUSED
57
#endif
58
59
#ifdef __MINGW64__