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

src/sock.c:542:5: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result #1501

Closed
subnut opened this issue Mar 29, 2022 · 2 comments

Comments

@subnut
Copy link

subnut commented Mar 29, 2022

  • My goal is: to make linux-libs on x86_64-musl (NOT glibc)

Environment

  • mongoose version: 7.6
  • Compiler/IDE and SDK: gcc version 10.2.1
  • Target hardware/board: x86-64

Elephant in the room

src/sock.c: In function 'mg_iotest':
src/sock.c:542:5: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
  542 |     if (FD(c) > maxfd) maxfd = FD(c);
      |     ^~~~~~
src/sock.c:542:5: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
src/sock.c:545:7: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
  545 |   }
      |       ^     
src/sock.c:545:7: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
src/sock.c:556:49: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
  556 |     c->is_writable = FD(c) != INVALID_SOCKET && FD_ISSET(FD(c), &wset);
      |                                                 ^~~~~~~~
src/sock.c:556:49: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
src/sock.c:557:49: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
  557 |   }
      |                                                 ^       
src/sock.c:557:49: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
@subnut
Copy link
Author

subnut commented Mar 29, 2022

Ping @cpq

@cpq
Copy link
Member

cpq commented Mar 30, 2022

That's actually a musl's header problem.
See https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/

Note: the error reporting is one line off. The real issue is on line 499: if you comment it out, the warning goes away. So the issue is with this line:

FD_SET(FD(c), &rset);

@subnut subnut closed this as completed Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants