build with warnings as errors in autotools build on travis (#1013)

build with warnings as errors in autotools build on travis
This commit is contained in:
Arvid Norberg 2016-08-19 01:05:43 -04:00 committed by GitHub
parent 9fd83aaa10
commit 8f7901dd25
5 changed files with 26 additions and 9 deletions

View File

@ -162,6 +162,8 @@ script:
- 'if [[ "$autotools" == "1" ]]; then
./autotool.sh &&
export CXX=g++-5 &&
export CC=gcc-5 &&
export CXXFLAGS="-Werror -Wno-deprecated-declarations" &&
./configure --enable-debug --enable-encryption --enable-examples --enable-tests --enable-python-binding &&
make -j2 check;
fi'

View File

@ -609,7 +609,8 @@ std::string path_to_url(std::string f)
#if defined TORRENT_WINDOWS && !defined TORRENT_MINGW
_getcwd(cwd, sizeof(cwd));
#else
getcwd(cwd, sizeof(cwd));
char const* ret = getcwd(cwd, sizeof(cwd));
(void)ret; // best effort
#endif
f = path_append(cwd, f);
}
@ -1575,10 +1576,10 @@ int main(int argc, char* argv[])
{
char url[4096];
puts("Enter magnet link:\n");
std::scanf("%4095s", url);
int ret = std::scanf("%4095s", url);
add_torrent_params p;
if (std::strstr(url, "magnet:") == url)
if (ret == 1 && std::strstr(url, "magnet:") == url)
{
add_torrent_params tmp;
parse_magnet_uri(url, tmp, ec);
@ -1634,8 +1635,8 @@ int main(int argc, char* argv[])
std::printf("\n\nARE YOU SURE YOU WANT TO DELETE THE FILES FOR '%s'. THIS OPERATION CANNOT BE UNDONE. (y/N)"
, st.name.c_str());
char response = 'n';
std::scanf("%c", &response);
if (response == 'y')
int ret = std::scanf("%c", &response);
if (ret == 1 && response == 'y')
{
// also delete the .torrent file from the torrent directory
handles_t::iterator i = std::find_if(files.begin(), files.end()

View File

@ -342,7 +342,13 @@ int main(int argc, char* argv[])
_getcwd(cwd, sizeof(cwd));
full_path = cwd + ("\\" + full_path);
#else
getcwd(cwd, sizeof(cwd));
char const* ret = getcwd(cwd, sizeof(cwd));
if (ret == NULL)
{
std::fprintf(stderr, "failed to get current working directory: %s\n"
, strerror(errno));
return 1;
}
full_path = cwd + ("/" + full_path);
#endif
}

View File

@ -74,7 +74,8 @@ int main(int argc, char* argv[])
// wait for the user to end
char a;
std::scanf("%c\n", &a);
int ret = std::scanf("%c\n", &a);
(void)ret; // ignore
return 0;
}

View File

@ -318,10 +318,17 @@ EXPORT int main(int argc, char const* argv[])
std::fprintf(stderr, "Failed to create test directory: %s\n", ec.message().c_str());
return 1;
}
int ret;
#ifdef TORRENT_WINDOWS
SetCurrentDirectoryA(dir);
#else
chdir(dir);
ret = chdir(dir);
if (ret != 0)
{
std::fprintf(stderr, "failed to change directory to \"%s\": %s"
, dir, strerror(errno));
return 1;
}
#endif
std::fprintf(stderr, "test: %s\ncwd = \"%s\"\nrnd: %x\n"
, executable, test_dir.c_str(), libtorrent::random(0xffffffff));
@ -467,7 +474,7 @@ EXPORT int main(int argc, char const* argv[])
fflush(stderr);
}
int ret = print_failures();
ret = print_failures();
#if !defined TORRENT_LOGGING
if (ret == 0 && !keep_files)
{