-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Description
I did this
Compiling the following minimal program with gcc 15.2:
#include <stdint.h>
#include "curl/curl.h"
int
main()
{
uint32_t auth = CURLAUTH_ANY;
auth &= CURLAUTH_ANYSAFE;
}
issues the following warning:
warning: conversion from ‘long unsigned int’ to ‘uint32_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551599’ to ‘4294967279’ [-Woverflow]
7 | uint32_t auth = CURLAUTH_ANY;
| ^~~~~~~~~~~~
Using options -Wno-overflow -Wconversion:
warning: conversion from ‘long unsigned int’ to ‘uint32_t’ {aka ‘unsigned int’} changes the value of ‘18446744073709551598’ [-Wconversion]
9 | auth &= CURLAUTH_ANYSAFE;
| ^~~~~~~~~~~~~~~~
IMO, curl.h computed constants should not have bits set outside their normal type domain. This is true at least for negated bit masks: aka:
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC | CURLAUTH_DIGEST_IE))
#define CURLSSH_AUTH_ANY ~0L /* all types supported by server */
The case of
#define CURLPROTO_ALL (~0L) /* enable everything */
is unclear as long as we do not yet define protocol numbers > 31.
I expected the following
No warnings.
curl/libcurl version
8.15.0
operating system
Fedora 43
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels