mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-28 01:41:49 +03:00
build: silence warnings inside FD_SET()
/FD_ISSET()
macros
Use an ugly workaround to silence `-Wsign-conversion` warnings triggered by the internals of `FD_SET()`/`FD_ISSET()` macros. They've been showing up in OmniOS CI builds when compiling `example` programs. They also have been seen with older Cygwin and other envs and configurations. Also scope two related variables in examples. E.g.: ``` ../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion] 251 | FD_SET(forwardsock, &fds); | ^~~~~~ ../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion] ../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion] ../../example/direct_tcpip.c:251:9: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion] ../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion] 259 | if(rc && FD_ISSET(forwardsock, &fds)) { | ^~~~~~~~ ../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion] ../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion] ``` Ref: https://github.com/libssh2/libssh2/actions/runs/8854199687/job/24316762831#step:3:2020 Closes #1379
This commit is contained in:
@ -50,7 +50,14 @@ static int waitsocket(libssh2_socket_t socket_fd, LIBSSH2_SESSION *session)
|
||||
|
||||
FD_ZERO(&fd);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
FD_SET(socket_fd, &fd);
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/* now make sure we wait in the correct direction */
|
||||
dir = libssh2_session_block_directions(session);
|
||||
|
Reference in New Issue
Block a user