Skip to content

Commit

Permalink
comment&code cosmetics; minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wfjm committed Nov 3, 2018
1 parent 6a09d0d commit 0913863
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
20 changes: 9 additions & 11 deletions doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,24 @@ The details are described in

#### <a id="build-cpp">Compile sharable libraries</a>

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

Expand Down
1 change: 1 addition & 0 deletions rtl/bplib/nexys4d/tb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tb_nexys4d_dummy
6 changes: 3 additions & 3 deletions tools/bin/create_disk
Original file line number Diff line number Diff line change
@@ -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 <W.F.J.Mueller@gsi.de>
# Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# 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
Expand Down Expand Up @@ -247,7 +247,7 @@ sub print_help {
my ($ptyp) = @_;
print "usage: create_disk [options] <file>\n";
print " --typ=<type> specified disk type, must be specified\n";
print " --ini=<pat> initialization pattern, can be\n";
print " --ini=<pat> 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";
Expand Down
9 changes: 5 additions & 4 deletions tools/src/librlink/RlinkPortFifo.cpp
Original file line number Diff line number Diff line change
@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// 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
Expand Down Expand Up @@ -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()",
Expand All @@ -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()",
Expand Down
5 changes: 3 additions & 2 deletions tools/src/librtools/Rtools.cpp
Original file line number Diff line number Diff line change
@@ -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 <W.F.J.Mueller@gsi.de>
//
Expand Down Expand Up @@ -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);
}

Expand All @@ -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",
Expand Down

0 comments on commit 0913863

Please sign in to comment.