git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 2/3] compat/posix.h: clean up GIT_GNUC_PREREQ() and UNUSED

From
DLDominik Loidolt <dominik.loidolt@univie.ac.at>
Date
Jun 13, 2026, 12:27 UTC
Message-ID
<20260613122711.38662-3-dominik.loidolt@univie.ac.at>
In-Reply-To
<20260613122711.38662-1-dominik.loidolt@univie.ac.at>

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>
---
 compat/posix.h | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/compat/posix.h b/compat/posix.h
index 273cb87101..d2de5cedf5 100644
--- a/compat/posix.h
+++ b/compat/posix.h
@@ -5,11 +5,10 @@
 
 /*
  * Derived from Linux "Features Test Macro" header
- * Convenience macros to test the versions of gcc (or
- * a compatible compiler).
+ * Convenience macros to test the versions of GCC (or a compatible compiler).
  * Use them like this:
  *  #if GIT_GNUC_PREREQ (2,8)
- *   ... code requiring gcc 2.8 or later ...
+ *   ... code requiring GCC 2.8 or later ...
  *  #endif
  *
  * Note that Clang and other compilers define __GNUC__ for compatibility; use
@@ -17,12 +16,12 @@
  *
  * This macro of course is not part of POSIX, but we need it for the UNUSED
  * macro which is used by some of our POSIX compatibility wrappers.
-*/
+ */
 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
 # define GIT_GNUC_PREREQ(maj, min) \
 	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 #else
- #define GIT_GNUC_PREREQ(maj, min) 0
+# define GIT_GNUC_PREREQ(maj, min) 0
 #endif
 
 /* Similar for Clang. */
@@ -48,13 +47,13 @@
  * compilation, consider using MAYBE_UNUSED instead.
  */
 #if GIT_GNUC_PREREQ(4, 5) || GIT_CLANG_PREREQ(2, 9)
-#define UNUSED __attribute__((unused)) \
-	__attribute__((deprecated ("parameter declared as UNUSED")))
+# define UNUSED __attribute__((unused)) \
+	__attribute__((deprecated("parameter declared as UNUSED")))
 #elif defined(__GNUC__)
-#define UNUSED __attribute__((unused)) \
+# define UNUSED __attribute__((unused)) \
 	__attribute__((deprecated))
 #else
-#define UNUSED
+# define UNUSED
 #endif
 
 #ifdef __MINGW64__
-- 
2.54.0
Previous: Dominik LoidoltNext: Dominik Loidolt
Message 16 of 20 in “compat/posix.h: enable UNUSED warning messages for Clang”
  1. compat/posix.h: enable UNUSED warning messages for ClangDominik Loidolt, May 3, 2026
  2. Junio C HamanoMay 4, 2026
  3. Junio C HamanoMay 4, 2026
  4. Dominik LoidoltJun 5, 2026
  5. compat/posix.h: enable UNUSED warning messages for ClangDominik Loidolt, Jun 5, 2026
  6. Patrick SteinhardtJun 5, 2026
  7. Dominik LoidoltJun 5, 2026
  8. Patrick SteinhardtJun 5, 2026
  9. Dominik LoidoltJun 5, 2026
  10. Patrick SteinhardtJun 8, 2026
  11. 1/2 compat/posix.h: enable UNUSED warning messages for ClangDominik Loidolt, Jun 8, 2026
  12. 2/2 compat/posix.h: simplify GIT_GNUC_PREREQ() comparisonDominik Loidolt, Jun 8, 2026
  13. Patrick SteinhardtJun 12, 2026
  14. Dominik LoidoltJun 12, 2026
  15. 0/3 compat/posix.h: enable UNUSED warning messages for ClangDominik Loidolt, Jun 13, 2026
  16. 2/3 compat/posix.h: clean up GIT_GNUC_PREREQ() and UNUSEDDominik Loidolt, Jun 13, 2026
  17. 1/3 compat/posix.h: enable UNUSED warning messages for ClangDominik Loidolt, Jun 13, 2026
  18. 3/3 compat/posix.h: simplify GIT_GNUC_PREREQ() comparisonDominik Loidolt, Jun 13, 2026
  19. Junio C HamanoJun 13, 2026
  20. Patrick SteinhardtJun 15, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.