]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
clang-tidy: work around clang-tidy <=20 false positive (Windows)
authorViktor Szakats <commit@vsz.me>
Thu, 19 Feb 2026 23:43:57 +0000 (00:43 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 20 Feb 2026 11:08:52 +0000 (12:08 +0100)
clang-tidy <= v20 (as seen between 18.1.3 and 20.1.2) report
`readability-uppercase-literal-suffix` originating from mingw-w64 system
header `_mingw_mac.h` via `define __MSABI_LONG(x) x ## l`

Triggered by `SOCKENOMEM` (e.g. in tests/server/sockfilt.c):
```
warning: integer literal has suffix 'l', which is not uppercase [readability-uppercase-literal-suffix]
```

Work around by replacing Windows macro `WSA_NOT_ENOUGH_MEMORY`
with its literal value.

Bug: https://github.com/curl/curl/pull/20631#issuecomment-3930619868
Follow-up to c07c3cac746bb899e8014200aad02e5f4bb507de #20629
Cherry-picked from #20631

Closes #20638

lib/curl_setup.h

index 09c01be482611221fae6253cbbd5b05f723083f1..bd30ba9cbcbb69bd0d33d273b07857044eb3b361 100644 (file)
@@ -1105,7 +1105,9 @@ typedef unsigned int curl_bit;
 #define SOCKEINVAL        WSAEINVAL
 #define SOCKEISCONN       WSAEISCONN
 #define SOCKEMSGSIZE      WSAEMSGSIZE
-#define SOCKENOMEM        WSA_NOT_ENOUGH_MEMORY
+/* Use literal value to work around clang-tidy <=20 misreporting
+  'readability-uppercase-literal-suffix' with mingw-w64 headers */
+#define SOCKENOMEM        8L  /* WSA_NOT_ENOUGH_MEMORY */
 #define SOCKETIMEDOUT     WSAETIMEDOUT
 #define SOCKEWOULDBLOCK   WSAEWOULDBLOCK
 #else