clang-tidy: enable more checks, fix fallouts

- enable three checks:
  - bugprone-invalid-enum-default-initialization
  - bugprone-sizeof-expression
  - readability-inconsistent-declaration-parameter-name (strict)
- fix remaining discrepancies with arg names in prototypes
  and implementation, in strict mode.
- document reason for some checks tested but not enabled.

Closes #20794
This commit is contained in:
Viktor Szakats 2026-03-03 01:58:29 +01:00
parent e0dd6eb4a4
commit df6014894b
No known key found for this signature in database
34 changed files with 222 additions and 209 deletions

View file

@ -53,7 +53,7 @@ size_t curlx_dyn_len(const struct dynbuf *s);
/* returns 0 on success, -1 on error */
/* The implementation of this function exists in mprintf.c */
int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list args);
/* Take the buffer out of the dynbuf. Caller has ownership and
* dynbuf resets to initial state. */

View file

@ -47,7 +47,7 @@ HANDLE curlx_CreateFile(const char *filename,
#define curlx_fstat _fstati64
#define curlx_struct_stat struct _stati64
FILE *curlx_win32_fopen(const char *filename, const char *mode);
FILE *curlx_win32_freopen(const char *filename, const char *mode, FILE *fh);
FILE *curlx_win32_freopen(const char *filename, const char *mode, FILE *fp);
int curlx_win32_stat(const char *path, curlx_struct_stat *buffer);
int curlx_win32_open(const char *filename, int oflag, ...);
int curlx_win32_rename(const char *oldpath, const char *newpath);

View file

@ -36,15 +36,15 @@
#include <arpa/inet.h>
#endif
#ifdef __AMIGA__
#define curlx_inet_ntop(af, addr, buf, size) \
(char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)(buf), \
#define curlx_inet_ntop(af, src, buf, size) \
(char *)inet_ntop(af, CURL_UNCONST(src), (unsigned char *)(buf), \
(curl_socklen_t)(size))
#else
#define curlx_inet_ntop(af, addr, buf, size) \
inet_ntop(af, addr, buf, (curl_socklen_t)(size))
#define curlx_inet_ntop(af, src, buf, size) \
inet_ntop(af, src, buf, (curl_socklen_t)(size))
#endif
#else
char *curlx_inet_ntop(int af, const void *addr, char *buf, size_t size);
char *curlx_inet_ntop(int af, const void *src, char *buf, size_t size);
#endif /* HAVE_INET_NTOP */
#endif /* HEADER_CURL_INET_NTOP_H */