Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: silence bogus -Wconversion warnings with gcc 5.1-5.4 #16398

Closed
wants to merge 1 commit into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Feb 19, 2025

It's fixed in gcc 5.5.0.

Example: https://godbolt.org/z/x6Th8q844

Seen in gcc 5.1.0, 5.4.0 (both 32/64-bit) with dl-mingw:

lib/rtsp.c: In function 'rtsp_parse_transport':
lib/rtsp.c:1025:36: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
           rtp_channel_mask[idx] |= (unsigned char)(1 << off);
                                    ^
lib/mprintf.c: In function 'parsefmt':
lib/mprintf.c:526:31: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[width/8] |= (unsigned char)(1 << (width&7));
                               ^
lib/mprintf.c:544:35: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[precision/8] |= (unsigned char)(1 << (precision&7));
                                   ^
lib/mprintf.c:559:29: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       usedinput[param/8] |= (unsigned char)(1 << (param&7));
                             ^
lib/cfilters.c: In function 'Curl_pollset_change':
lib/cfilters.c:935:25: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       ps->actions[i] |= (unsigned char)add_flags;
                         ^

gcc 5.1.0: https://github.com/curl/curl/actions/runs/13413103492/job/37467698381#step:9:21
gcc 5.4.0: https://github.com/curl/curl/actions/runs/13413103492/job/37467694479#step:9:19

Example: https://godbolt.org/z/x6Th8q844

Seen in gcc 5.1.0, 5.4.0 (both 32/64-bit) with dl-mingw:
```
curl/lib/rtsp.c: In function 'rtsp_parse_transport':
curl/lib/rtsp.c:1025:36: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
           rtp_channel_mask[idx] |= (unsigned char)(1 << off);
                                    ^
curl/lib/mprintf.c: In function 'parsefmt':
curl/lib/mprintf.c:526:31: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[width/8] |= (unsigned char)(1 << (width&7));
                               ^
curl/lib/mprintf.c:544:35: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[precision/8] |= (unsigned char)(1 << (precision&7));
                                   ^
curl/lib/mprintf.c:559:29: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       usedinput[param/8] |= (unsigned char)(1 << (param&7));
                             ^
curl/lib/cfilters.c: In function 'Curl_pollset_change':
curl/lib/cfilters.c:935:25: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       ps->actions[i] |= (unsigned char)add_flags;
                         ^
```
gcc 5.4: https://github.com/curl/curl/actions/runs/13413103492/job/37467694479#step:9:19
gcc 5.1: https://github.com/curl/curl/actions/runs/13413103492/job/37467698381#step:9:21
@vszakats vszakats added the build label Feb 19, 2025
@vszakats vszakats closed this in ee3f657 Feb 19, 2025
@vszakats vszakats deleted the b-gcc5-bogus-warn branch February 19, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant