From 0913863793e2befad783742ba5d1d8d2b73f06b3 Mon Sep 17 00:00:00 2001 From: wfjm Date: Sat, 3 Nov 2018 10:30:00 +0100 Subject: [PATCH] comment&code cosmetics; minor changes --- doc/INSTALL.md | 20 +++++++++----------- rtl/bplib/nexys4d/tb/.gitignore | 1 + tools/bin/create_disk | 6 +++--- tools/src/librlink/RlinkPortFifo.cpp | 9 +++++---- tools/src/librtools/Rtools.cpp | 5 +++-- 5 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 rtl/bplib/nexys4d/tb/.gitignore diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 0f46e1d5..ba51d510 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -136,26 +136,24 @@ The details are described in #### Compile sharable libraries -Note: some `c++11` features are used in the code - -| Feature | Description | in gcc since | -| :------ | :---------- | :----------: | -| N2343 | decltype (used by boost bind) | gcc 4.3 | -| N2431 | nullptr | gcc 4.6 | -| N2930 | range based for | gcc 4.6 | -| N1984 | auto-types variables | gcc 4.4 | +The backend code base uses now many `c++11` langauge features, e.g. +`nullptr`, `auto`, lambda functions, list initialization, range-based `for`, +to name the most prominent. +A C++ compiler with full `c++11` support is therefore needed, so either +`gcc 4.8.1` or `clang 3.3`. Current experience is: +- gcc 5.4.0 and clang 3.8.0, as in Ubuntu 16.04 LTS, _will work !!_ +- gcc 4.7.2 and clang 3.0-6.2, as in Debian 7, _will not work !!_ Required tools and libraries: - g++ >= 4.6 (see c++11 usage above) + g++ >= 4.8.1 (see c++11 usage above) boost >= 1.35 (boost::thread api changed, new one is used) - linusb >= 1.0.5 (timerfd support) + libusb >= 1.0.5 (timerfd support) Build was tested under: ubuntu xenial (16.04 LTS): gcc 5.4.0 boost 1.58 libusb 1.0.20 ubuntu trusty (14.04 LTS): gcc 4.8.2 boost 1.54 libusb 1.0.17 - debian wheezy (7.0.8): gcc 4.7.2 boost 1.49 libusb 1.0.11 To build all sharable libraries diff --git a/rtl/bplib/nexys4d/tb/.gitignore b/rtl/bplib/nexys4d/tb/.gitignore new file mode 100644 index 00000000..6bd04d4a --- /dev/null +++ b/rtl/bplib/nexys4d/tb/.gitignore @@ -0,0 +1 @@ +tb_nexys4d_dummy diff --git a/tools/bin/create_disk b/tools/bin/create_disk index b5f0f403..0475a6c1 100755 --- a/tools/bin/create_disk +++ b/tools/bin/create_disk @@ -1,7 +1,7 @@ #!/usr/bin/perl -w -# $Id: create_disk 985 2018-01-03 08:59:40Z mueller $ +# $Id: create_disk 1059 2018-10-27 10:34:16Z mueller $ # -# Copyright 2013-2015 by Walter F.J. Mueller +# Copyright 2013-2018 by Walter F.J. Mueller # # This program is free software; you may redistribute and/or modify it under # the terms of the GNU General Public License as published by the Free @@ -247,7 +247,7 @@ sub print_help { my ($ptyp) = @_; print "usage: create_disk [options] \n"; print " --typ= specified disk type, must be specified\n"; - print " --ini= initialization pattern, can be\n"; + print " --ini= initialization pattern, available patterns below\n"; print " --bad create factory bad block table on last track\n"; print " --boot write dummy boot block, print volume info and HALT\n"; print " --help print full help, with list --typ and --ini options\n"; diff --git a/tools/src/librlink/RlinkPortFifo.cpp b/tools/src/librlink/RlinkPortFifo.cpp index b8e9dbae..d303d687 100644 --- a/tools/src/librlink/RlinkPortFifo.cpp +++ b/tools/src/librlink/RlinkPortFifo.cpp @@ -1,6 +1,6 @@ -// $Id: RlinkPortFifo.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlinkPortFifo.cpp 1063 2018-10-29 18:37:42Z mueller $ // -// Copyright 2011-2017 by Walter F.J. Mueller +// Copyright 2011-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -95,7 +95,7 @@ int RlinkPortFifo::OpenFifo(const std::string& name, bool snd, RerrMsg& emsg) int irc; - irc = stat(name.c_str(), &stat_fifo); + irc = ::stat(name.c_str(), &stat_fifo); if (irc == 0) { if ((stat_fifo.st_mode & S_IFIFO) == 0) { emsg.Init("RlinkPortFifo::OpenFiFo()", @@ -112,7 +112,8 @@ int RlinkPortFifo::OpenFifo(const std::string& name, bool snd, RerrMsg& emsg) return -1; } } - + + /* coverity[toctou] */ irc = ::open(name.c_str(), snd ? O_WRONLY : O_RDONLY); if (irc < 0) { emsg.InitErrno("RlinkPortFifo::OpenFifo()", diff --git a/tools/src/librtools/Rtools.cpp b/tools/src/librtools/Rtools.cpp index 49388461..afb87ce7 100644 --- a/tools/src/librtools/Rtools.cpp +++ b/tools/src/librtools/Rtools.cpp @@ -1,4 +1,4 @@ -// $Id: Rtools.cpp 1059 2018-10-27 10:34:16Z mueller $ +// $Id: Rtools.cpp 1063 2018-10-29 18:37:42Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -122,7 +122,7 @@ bool CreateBackupFile(const std::string& fname, size_t nbackup, RerrMsg& emsg) fnames.push_back(fname); for (size_t i=1; i<=nbackup; i++) { char fnum[4]; - snprintf(fnum, 4, "%d", (int)i); + ::snprintf(fnum, sizeof(fnum), "%d", (int)i); fnames.push_back(fbase + "_" + fnum + fext); } @@ -144,6 +144,7 @@ bool CreateBackupFile(const std::string& fname, size_t nbackup, RerrMsg& emsg) return false; } // here we know old file exists and is a regular file + /* coverity[toctou] */ irc = ::rename(fnam_old.c_str(), fnam_new.c_str()); if (irc < 0) { emsg.InitErrno("Rtools::CreateBackupFile",