Skip to content

Commit 3b8f156

Browse files
author
Herbert Koelman
committed
Merge branch 'iss-64' into develop
2 parents 9688f79 + 487b4e8 commit 3b8f156

File tree

11 files changed

+86
-44
lines changed

11 files changed

+86
-44
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Makefile
5353

5454
# layout
5555
doxyfile
56+
*.tar
57+
sonar-project.properties
5658
distrib/
5759
lib/
5860
doc/

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ globber:clean
3232
clean:
3333
-(cd src && $(MAKE) clean)
3434

35-
codecheck: clean all
35+
codecheck: all
3636
$(CODECHECK)
3737

3838
version:

configure

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for cpp-pthread v1.3.3.
3+
# Generated by GNU Autoconf 2.69 for cpp-pthread v1.4.0.
44
#
55
# Report bugs to <[email protected]>.
66
#
@@ -579,8 +579,8 @@ MAKEFLAGS=
579579
# Identity of this package.
580580
PACKAGE_NAME='cpp-pthread'
581581
PACKAGE_TARNAME='cpp-pthread'
582-
PACKAGE_VERSION='v1.3.3'
583-
PACKAGE_STRING='cpp-pthread v1.3.3'
582+
PACKAGE_VERSION='v1.4.0'
583+
PACKAGE_STRING='cpp-pthread v1.4.0'
584584
PACKAGE_BUGREPORT='[email protected]'
585585
PACKAGE_URL='http://herbertkoelman.github.io/cpp-pthread/'
586586

@@ -1187,7 +1187,7 @@ if test "$ac_init_help" = "long"; then
11871187
# Omit some internal or obsolete options to make the list less imposing.
11881188
# This message is too long to be a string in the A/UX 3.1 sh.
11891189
cat <<_ACEOF
1190-
\`configure' configures cpp-pthread v1.3.3 to adapt to many kinds of systems.
1190+
\`configure' configures cpp-pthread v1.4.0 to adapt to many kinds of systems.
11911191
11921192
Usage: $0 [OPTION]... [VAR=VALUE]...
11931193
@@ -1251,7 +1251,7 @@ fi
12511251

12521252
if test -n "$ac_init_help"; then
12531253
case $ac_init_help in
1254-
short | recursive ) echo "Configuration of cpp-pthread v1.3.3:";;
1254+
short | recursive ) echo "Configuration of cpp-pthread v1.4.0:";;
12551255
esac
12561256
cat <<\_ACEOF
12571257
@@ -1332,7 +1332,7 @@ fi
13321332
test -n "$ac_init_help" && exit $ac_status
13331333
if $ac_init_version; then
13341334
cat <<\_ACEOF
1335-
cpp-pthread configure v1.3.3
1335+
cpp-pthread configure v1.4.0
13361336
generated by GNU Autoconf 2.69
13371337
13381338
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1349,7 +1349,7 @@ cat >config.log <<_ACEOF
13491349
This file contains any messages produced by compilers while
13501350
running configure, to aid debugging if configure makes a mistake.
13511351
1352-
It was created by cpp-pthread $as_me v1.3.3, which was
1352+
It was created by cpp-pthread $as_me v1.4.0, which was
13531353
generated by GNU Autoconf 2.69. Invocation command line was
13541354
13551355
$ $0 $@
@@ -2012,7 +2012,7 @@ do
20122012
test -z "$as_dir" && as_dir=.
20132013
for ac_exec_ext in '' $ac_executable_extensions; do
20142014
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2015-
ac_cv_prog_CODECHECK="sonar-runner -Dsonar.cfamily.library.directories=./include,/usr/include,$IMSDIR/include,$TUXDIR/include"
2015+
ac_cv_prog_CODECHECK="sonar-runner -Dsonar.cfamily.library.directories=./include,/usr/include"
20162016
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
20172017
break 2
20182018
fi
@@ -2099,7 +2099,7 @@ HEADERS=$HEADERS
20992099
21002100
subdirs="$subdirs src"
21012101
2102-
ac_config_files="$ac_config_files Makefile doxyfile"
2102+
ac_config_files="$ac_config_files Makefile doxyfile sonar-project.properties"
21032103
21042104
cat >confcache <<\_ACEOF
21052105
# This file is a shell script that caches the results of configure
@@ -2643,7 +2643,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
26432643
# report actual input values of CONFIG_FILES etc. instead of their
26442644
# values after options handling.
26452645
ac_log="
2646-
This file was extended by cpp-pthread $as_me v1.3.3, which was
2646+
This file was extended by cpp-pthread $as_me v1.4.0, which was
26472647
generated by GNU Autoconf 2.69. Invocation command line was
26482648
26492649
CONFIG_FILES = $CONFIG_FILES
@@ -2697,7 +2697,7 @@ _ACEOF
26972697
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
26982698
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
26992699
ac_cs_version="\\
2700-
cpp-pthread config.status v1.3.3
2700+
cpp-pthread config.status v1.4.0
27012701
configured by $0, generated by GNU Autoconf 2.69,
27022702
with options \\"\$ac_cs_config\\"
27032703
@@ -2811,6 +2811,7 @@ do
28112811
case $ac_config_target in
28122812
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
28132813
"doxyfile") CONFIG_FILES="$CONFIG_FILES doxyfile" ;;
2814+
"sonar-project.properties") CONFIG_FILES="$CONFIG_FILES sonar-project.properties" ;;
28142815
28152816
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
28162817
esac

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AC_PROG_MKDIR_P
2222
# Okay, no cppcheck found, maybe we have sonar
2323
if test -z "$CODECHECK"
2424
then
25-
AC_CHECK_PROG([CODECHECK],[sonar-runner],[sonar-runner -Dsonar.cfamily.library.directories=./include,/usr/include,$IMSDIR/include,$TUXDIR/include],[])
25+
AC_CHECK_PROG([CODECHECK],[sonar-runner],[sonar-runner -Dsonar.cfamily.library.directories=./include,/usr/include],[])
2626
fi
2727

2828
# Okay, no cppcheck found, maybe we have sonar
@@ -47,6 +47,6 @@ done
4747
AC_SUBST(HEADERS,$HEADERS)
4848

4949
AC_CONFIG_SUBDIRS(src)
50-
AC_CONFIG_FILES([Makefile doxyfile])
50+
AC_CONFIG_FILES([Makefile doxyfile sonar-project.properties])
5151
AC_OUTPUT
5252

include/pthread/condition_variable.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// recommandation for more info p.285 §8.3.1).
1111
#include <pthread.h>
1212
#include <string>
13-
#include <time.h>
13+
#include <ctime>
1414
#include <sys/time.h>
1515

1616
#include "pthread/config.h"
@@ -231,7 +231,7 @@ namespace pthread {
231231
milliseconds(millis); // update timeout
232232
bool stop_waiting = lambda(); // returns ​false if the waiting should be continued.
233233

234-
while(! stop_waiting && status == no_timeout){
234+
while((! stop_waiting) && (status == no_timeout)){
235235

236236
rc = pthread_cond_timedwait ( &_condition, &mtx._mutex, &timeout );
237237

@@ -242,11 +242,11 @@ namespace pthread {
242242
break;
243243

244244
case EINVAL:
245-
throw condition_variable_exception("The value specified by abstime is invalid.", rc);
245+
throw condition_variable_exception("The value specified by abstime is invalid.", rc); // NOSONAR we use throw instead of return.
246246
break;
247247

248248
case EPERM:
249-
throw condition_variable_exception("The mutex was not owned by the current thread at the time of the call.", rc);
249+
throw condition_variable_exception("The mutex was not owned by the current thread at the time of the call.", rc); // NOSONAR we use throw instead of return.
250250
break;
251251
default:
252252
status = no_timeout ;

include/pthread/exceptions.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
#include <pthread.h>
1313

14-
#include <errno.h>
14+
#include <cerrno>
1515
#include <string> // std::string
1616
#include <cstring>
1717
#include <exception> // std::exception
1818

1919

2020
namespace pthread {
2121

22-
using namespace std ;
22+
// using namespace std ;
2323

2424
/** \addtogroup exception Errors and exceptions
2525
*
@@ -31,15 +31,15 @@ namespace pthread {
3131

3232
/** general purpose pthread exception.
3333
*/
34-
class pthread_exception: public exception {
34+
class pthread_exception: public std::exception {
3535

3636
public:
3737

3838
/**
3939
* @param message error message
4040
* @param pthread_errno a pthread function return code.
4141
*/
42-
pthread_exception( const string &message, const int pthread_errno = -1 );
42+
pthread_exception( const std::string &message, const int pthread_errno = -1 );
4343

4444
virtual ~pthread_exception();
4545

@@ -71,7 +71,7 @@ namespace pthread {
7171
*
7272
* @param message timeout condition
7373
*/
74-
timeout_exception(const string &message);
74+
explicit timeout_exception(const std::string &message);
7575
};
7676

7777
/** throw to indicate that something went wrong with a mutex.
@@ -84,7 +84,7 @@ namespace pthread {
8484
* @param message short description
8585
* @param pthread_errno error returned by the pthread function
8686
*/
87-
mutex_exception( const std::string &message, const int pthread_errno = -1) ;
87+
explicit mutex_exception( const std::string &message, const int pthread_errno = -1) ;
8888

8989
};
9090

@@ -98,7 +98,7 @@ namespace pthread {
9898
* @param message short description
9999
* @param pthread_errno error returned by the pthread function
100100
*/
101-
condition_variable_exception( const string &message, const int pthread_errno = -1);
101+
condition_variable_exception( const std::string &message, const int pthread_errno = -1);
102102
virtual ~condition_variable_exception(){};
103103
};
104104

@@ -109,7 +109,7 @@ namespace pthread {
109109
* @param message short error description.
110110
* @param pthread_error value return by a function in the pthread library.
111111
*/
112-
thread_exception(const string &message, const int pthread_error = -1);
112+
thread_exception(const std::string &message, const int pthread_error = -1);
113113
};
114114

115115
namespace util {

include/pthread/lock_guard.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
namespace pthread {
2121

22-
using namespace std ;
23-
2422
/** \addtogroup concurrency
2523
*
2624
* @{

include/pthread/thread.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ namespace pthread {
6767
#else
6868
virtual void run () noexcept = 0 ;
6969
#endif
70+
71+
virtual ~runnable() {};
7072
};
7173

7274
/**
@@ -107,7 +109,7 @@ namespace pthread {
107109
*
108110
* @param other thread that will be moved, on completion other is no longer a thread.
109111
*/
110-
thread( thread&& other);
112+
thread( thread&& other); // NOSONAR this is std interface and cannot be changed
111113

112114
/** Copy constructor is flagged deleted because it makes no sense to copy a thread.
113115
*/
@@ -160,7 +162,7 @@ namespace pthread {
160162
* @param other thread to move, on completion it is not a thread anymore (thread_status::not_a_thread).
161163
* @return a thread
162164
*/
163-
thread& operator=(thread&& other);
165+
thread& operator=(thread&& other); // NOSONAR this is a std method signature
164166

165167
private:
166168

@@ -241,7 +243,7 @@ namespace pthread {
241243
*
242244
* @param stack_size thread's stack size (default 0 which means use PTHREAD_STACK_MIN)
243245
*/
244-
abstract_thread(const std::size_t stack_size = 0);
246+
explicit abstract_thread(const std::size_t stack_size = 0);
245247
virtual ~abstract_thread();
246248

247249
/** start running the `run()` method in a new thread.
@@ -294,9 +296,9 @@ namespace pthread {
294296
* @param destructor_joins_first if true then destructor tries to wait for all registered threads to join the calling one before deleting thread instances.
295297
*/
296298
#if __cplusplus < 201103L
297-
thread_group( bool destructor_joins_first = false ) throw();
299+
explicit thread_group( bool destructor_joins_first = false ) throw();
298300
#else
299-
thread_group( bool destructor_joins_first = false ) noexcept;
301+
explicit thread_group( bool destructor_joins_first = false ) noexcept;
300302
#endif
301303

302304
/** delete all abstract_thread referenced by the thread_group.

sonar-project.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ sonar.projectKey=pmu:cpp_pthread
1414

1515
# Name of the project that will be displayed on the web interface.
1616
sonar.projectName=pmu:cpp-pthread
17-
sonar.projectVersion=draft
17+
sonar.projectVersion=v1.4.0
1818

1919
# Comma-separated paths to directories containing source files
20-
sonar.sources=src
20+
sonar.sources=src,include/pthread
21+
sonar.cfamily.build-wrapper-output.bypass=true
22+
2123
# Set the language of the source code to analyze. If not set, a multi-language analysis will be triggered.
2224
#sonar.language=
2325
# to exclude source code files

sonar-project.properties.in

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Project Configuration
3+
# Customize & run /path/to/sonar-runner/bin/sonar-runner -Dproject.settings=/path/to/sonar-project.properties
4+
#
5+
# Add more detail to both client and server-side analysis logs.
6+
sonar.verbose=false
7+
8+
# Specify not the the source directory, but some parent of the source directory
9+
#sonar.projectBaseDir=/path/to/project/root
10+
#sonar.working.directory=/path/to/working/folder/.sonar
11+
12+
# The project key that is unique for each project.
13+
sonar.projectKey=pmu:cpp_pthread
14+
15+
# Name of the project that will be displayed on the web interface.
16+
sonar.projectName=pmu:cpp-pthread
17+
sonar.projectVersion=@PACKAGE_VERSION@
18+
19+
# Comma-separated paths to directories containing source files
20+
sonar.sources=src,include/pthread
21+
sonar.cfamily.build-wrapper-output.bypass=true
22+
23+
# Set the language of the source code to analyze. If not set, a multi-language analysis will be triggered.
24+
#sonar.language=
25+
# to exclude source code files
26+
sonar.exclusions=**/TST/**/*,**/TST/*
27+
28+
# Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.
29+
#sonar.cobol.file.suffixes=cbl,kbl,sqb,kqb,cpy
30+
#sonar.cobol.copy.directories=
31+
#sonar.cobol.copy.suffixes=
32+
33+
#sonar.c.file.suffixes=.c,.h
34+
#sonar.cpp.file.suffixes=.cc,.cpp,.cxx,.c++,.hh,.hpp,.hxx,.h++,.ipp,.kpp,.sqC,.kqp
35+
#sonar.cfamily.predefinedMacros=#include "requiredMacros.h"
36+
#sonar.cfamily.library.directories=/path/to/requiredMacros.h,/path/to/include/files
37+

0 commit comments

Comments
 (0)