Merge pull request #44121 from azat/build/freebsd-warnings

Fix -Wshorten-64-to-32 on FreeBSD and enable -Werror
This commit is contained in:
Robert Schulze 2022-12-12 15:11:12 +01:00 committed by GitHub
commit b5797d4f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 11 deletions

View File

@ -448,12 +448,7 @@ else()
link_libraries(global-group)
endif ()
if (NOT (OS_LINUX OR OS_DARWIN))
# Using system libs can cause a lot of warnings in includes (on macro expansion).
option(WERROR "Enable -Werror compiler option" OFF)
else ()
option(WERROR "Enable -Werror compiler option" ON)
endif ()
option(WERROR "Enable -Werror compiler option" ON)
if (WERROR)
# Don't pollute CMAKE_CXX_FLAGS with -Werror as it will break some CMake checks.

View File

@ -153,7 +153,7 @@ restart:
/* Restore old terminal settings and signals. */
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
const int sigttou = signo[SIGTTOU];
const int sigttou = (int)signo[SIGTTOU];
/* Ignore SIGTTOU generated when we are not the fg pgrp. */
while (tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm) == -1 &&

View File

@ -44,7 +44,7 @@ private:
int fd;
#endif
#if defined(OS_FREEBSD)
int pagesize;
size_t pagesize;
pid_t self;
#endif
};

View File

@ -124,12 +124,12 @@ int io_submit(int ctx, long nr, struct iocb * iocbpp[])
}
}
return nr;
return static_cast<int>(nr);
}
int io_getevents(int ctx, long, long max_nr, struct kevent * events, struct timespec * timeout)
{
return kevent(ctx, nullptr, 0, events, max_nr, timeout);
return kevent(ctx, nullptr, 0, events, static_cast<int>(max_nr), timeout);
}

View File

@ -203,7 +203,7 @@ void ClientInfo::setInitialQuery()
void ClientInfo::fillOSUserHostNameAndVersionInfo()
{
os_user.resize(256, '\0');
if (0 == getlogin_r(os_user.data(), os_user.size() - 1))
if (0 == getlogin_r(os_user.data(), static_cast<int>(os_user.size() - 1)))
os_user.resize(strlen(os_user.c_str()));
else
os_user.clear(); /// Don't mind if we cannot determine user login.