diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-03-27 19:35:46 +0000 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-03-27 19:35:46 +0000 | 
| commit | 26e4b00f50502f788b67d09eccb06f121d72fc2f (patch) | |
| tree | 1c34b7dd54b3d14118aa0b5ae72236a83c5c3448 | |
| parent | Bump Ice v3.7.2 (diff) | |
| download | icespider-26e4b00f50502f788b67d09eccb06f121d72fc2f.tar.bz2 icespider-26e4b00f50502f788b67d09eccb06f121d72fc2f.tar.xz icespider-26e4b00f50502f788b67d09eccb06f121d72fc2f.zip  | |
Enable some clang-tidy checks and fix up accordingly
| -rw-r--r-- | icespider/common/Jamfile.jam | 17 | ||||
| -rw-r--r-- | icespider/compile/Jamfile.jam | 5 | ||||
| -rw-r--r-- | icespider/compile/routeCompiler.cpp | 5 | ||||
| -rw-r--r-- | icespider/compile/slice/Jamroot.jam | 1 | ||||
| -rw-r--r-- | icespider/core/Jamfile.jam | 6 | ||||
| -rw-r--r-- | icespider/core/ihttpRequest.h | 7 | ||||
| -rw-r--r-- | icespider/core/xwwwFormUrlEncoded.cpp | 1 | ||||
| -rw-r--r-- | icespider/fcgi/cgiRequestBase.cpp | 1 | ||||
| -rw-r--r-- | icespider/fileSessions/fileSessions.cpp | 3 | ||||
| -rw-r--r-- | icespider/testing/testRequest.cpp | 2 | ||||
| -rw-r--r-- | icespider/unittests/Jamfile.jam | 28 | ||||
| -rw-r--r-- | icespider/unittests/testRoutes.json | 7 | 
12 files changed, 57 insertions, 26 deletions
diff --git a/icespider/common/Jamfile.jam b/icespider/common/Jamfile.jam index 0c53482..dc13273 100644 --- a/icespider/common/Jamfile.jam +++ b/icespider/common/Jamfile.jam @@ -1,23 +1,26 @@  lib adhocutil : : : : <include>/usr/include/adhocutil ;  lib slicer : : : : <include>/usr/include/slicer ; -cpp http-slicer : -	http.ice -	: -	<slicer>pure -	; +obj http : http.ice : <toolset>tidy:<checker>none ; +obj session : session.ice : <toolset>tidy:<checker>none ;  lib icespider-common : -	[ glob-tree *.ice *.cpp : bin ] -	http-slicer +	[ glob *.cpp ] +	http session +	http.ice  	:  	<library>adhocutil  	<library>..//pthread  	<library>..//Ice  	<library>slicer +	<slicer>pure +	<implicit-dependency>http +	<implicit-dependency>session  	: :  	<library>..//pthread  	<library>..//Ice +	<implicit-dependency>http +	<implicit-dependency>session  	<include>.  	; diff --git a/icespider/compile/Jamfile.jam b/icespider/compile/Jamfile.jam index f65800e..8d01d72 100644 --- a/icespider/compile/Jamfile.jam +++ b/icespider/compile/Jamfile.jam @@ -5,11 +5,13 @@ lib boost_program_options ;  lib stdc++fs ;  lib mcpp ; +obj routes : routes.ice : <use>../common//icespider-common <toolset>tidy:<checker>none ;  lib icespider-compile :  	routeCompiler.cpp  	routes.ice +	routes  	: -	<slicer>yes +	<slicer>pure  # Need to disable LTO here cos of a GCC bug, this isn't  # performance critical anyway  	<linkflags>-fno-lto @@ -21,6 +23,7 @@ lib icespider-compile :  	<library>slice//Slice  	<library>../common//icespider-common  	<implicit-dependency>../common//icespider-common +	<implicit-dependency>routes  	<library>..//Ice  	<library>..//pthread  	<library>mcpp diff --git a/icespider/compile/routeCompiler.cpp b/icespider/compile/routeCompiler.cpp index ae48428..75737ee 100644 --- a/icespider/compile/routeCompiler.cpp +++ b/icespider/compile/routeCompiler.cpp @@ -74,10 +74,12 @@ namespace IceSpider {  				auto fqon = boost::algorithm::join(ns + cls->name(), ".");  				if (fqon == tn) return { NULL, cls->declaration() };  				auto t = findType(tn, cls, ns + cls->name()); +				// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)  				if (t.first || t.second) return t;  			}  			for (const auto & m : c->modules()) {  				auto t = findType(tn, m, ns + m->name()); +				// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)  				if (t.first || t.second) return t;  			}  			return { NULL, NULL }; @@ -87,6 +89,7 @@ namespace IceSpider {  		RouteCompiler::findType(const std::string & tn, const Units & us)  		{  			for (const auto & u : us) { +				// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)  				auto t = findType(tn, u.second);  				if (t.first || t.second) return t;  			} @@ -439,6 +442,8 @@ namespace IceSpider {  					auto ip = ps.find(p.first)->second;  					const auto paramType = "std::remove_cvref<%?>::type"_fmt(  						Slice::inputTypeToString(ip->type(), false, "", ip->getMetaData())); +					// This shouldn't be needed... the warning is ignored elsewhere to no effect +					fprintbf(4, output, "// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)\n");  					if (p.second->source == ParameterSource::Body) {  						if (p.second->key) {  							if (!doneBody) { diff --git a/icespider/compile/slice/Jamroot.jam b/icespider/compile/slice/Jamroot.jam index 46b4e3c..f83b79e 100644 --- a/icespider/compile/slice/Jamroot.jam +++ b/icespider/compile/slice/Jamroot.jam @@ -13,6 +13,7 @@ lib Slice :  	$(ice)/cpp/src/Slice/FileTracker.cpp  	$(ice)/cpp/src/Slice/Scanner.cpp  	: +	<toolset>tidy:<checker>none  	<cxxflags>-fPIC  	<include>$(ice)/cpp/src  	<link>static diff --git a/icespider/core/Jamfile.jam b/icespider/core/Jamfile.jam index 2f2f733..91e92e9 100644 --- a/icespider/core/Jamfile.jam +++ b/icespider/core/Jamfile.jam @@ -2,16 +2,20 @@ lib adhocutil : : : : <include>/usr/include/adhocutil ;  lib slicer : : : : <include>/usr/include/slicer ;  lib stdc++fs ; +obj routeOptions : routeOptions.ice : <toolset>tidy:<checker>none ;  lib icespider-core : -	[ glob-tree *.c *.cpp *.ice : bin ] +	[ glob *.c *.cpp ] +	routeOptions  	:  	<library>../common//icespider-common  	<library>adhocutil  	<library>slicer  	<library>stdc++fs  	<implicit-dependency>../common +	<implicit-dependency>routeOptions  	: :  	<include>.  	<library>../common//icespider-common  	<implicit-dependency>../common +	<implicit-dependency>routeOptions  	; diff --git a/icespider/core/ihttpRequest.h b/icespider/core/ihttpRequest.h index fb56efb..e1044f1 100644 --- a/icespider/core/ihttpRequest.h +++ b/icespider/core/ihttpRequest.h @@ -53,8 +53,12 @@ namespace IceSpider {  					else if constexpr (std::is_constructible<std::string_view, T>::value) {  						return T(*v);  					} +					else if constexpr (std::is_same<std::string, T>::value) { +						return std::to_string(*v); +					}  					else {  						try { +							// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)  							return boost::lexical_cast<T>(*v);  						}  						catch (const boost::bad_lexical_cast & e) { @@ -62,13 +66,14 @@ namespace IceSpider {  						}  					}  				} -				else {	 +				else {  					return std::nullopt;  				}  			}  			template<typename T>  			T getURLParam(unsigned int n) const  			{ +				// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)  				return *getFrom<T, unsigned int>(n, &IHttpRequest::getURLParam);  			}  			template<typename T> diff --git a/icespider/core/xwwwFormUrlEncoded.cpp b/icespider/core/xwwwFormUrlEncoded.cpp index a9e19ba..7f4bdcd 100644 --- a/icespider/core/xwwwFormUrlEncoded.cpp +++ b/icespider/core/xwwwFormUrlEncoded.cpp @@ -72,6 +72,7 @@ namespace IceSpider {  			SET(Ice::Int);  			SET(Ice::Long);  			SET(Ice::Float); +			// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)  			SET(Ice::Double);  			const std::string & s;  	}; diff --git a/icespider/fcgi/cgiRequestBase.cpp b/icespider/fcgi/cgiRequestBase.cpp index 8735d87..ab4d5e8 100644 --- a/icespider/fcgi/cgiRequestBase.cpp +++ b/icespider/fcgi/cgiRequestBase.cpp @@ -80,6 +80,7 @@ namespace IceSpider {  	{  		namespace ba = boost::algorithm;  		if (auto path = findFirstOrElse<Http400_BadRequest>(envmap, REDIRECT_URL, SCRIPT_NAME).substr(1); +				// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)  				!path.empty()) {  			ba::split(pathElements, path, ba::is_any_of("/"), ba::token_compress_off);  		} diff --git a/icespider/fileSessions/fileSessions.cpp b/icespider/fileSessions/fileSessions.cpp index e1c3b5c..ad026da 100644 --- a/icespider/fileSessions/fileSessions.cpp +++ b/icespider/fileSessions/fileSessions.cpp @@ -35,6 +35,7 @@ namespace IceSpider {  			SessionPtr createSession(const ::Ice::Current &) override  			{  				auto s = std::make_shared<Session>(); +				// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)  				s->id = boost::lexical_cast<std::string>(boost::uuids::random_generator()());  				s->duration = duration;  				save(s); @@ -109,7 +110,7 @@ namespace IceSpider {  				while (di != std::filesystem::directory_iterator()) {  					auto s = load(di->path());  					if (s && isExpired(s)) { -						destroySession(s->id, Ice::Current()); +						FileSessions::destroySession(s->id, Ice::Current());  					}  					di++;  				} diff --git a/icespider/testing/testRequest.cpp b/icespider/testing/testRequest.cpp index 1c0d9cb..5aa5bce 100644 --- a/icespider/testing/testRequest.cpp +++ b/icespider/testing/testRequest.cpp @@ -10,7 +10,9 @@ namespace IceSpider {  	{  		namespace ba = boost::algorithm;  		auto path = p.substr(1); +		// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)  		if (!path.empty()) { +			// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)  			ba::split(url, path, ba::is_any_of("/"), ba::token_compress_off);  		}  	} diff --git a/icespider/unittests/Jamfile.jam b/icespider/unittests/Jamfile.jam index 352d665..bf31020 100644 --- a/icespider/unittests/Jamfile.jam +++ b/icespider/unittests/Jamfile.jam @@ -43,7 +43,7 @@ run  	:  	<define>BOOST_TEST_DYN_LINK  	<library>testCommon -	<library>test-api +	<library>test-api-lib  	<library>dl  	<library>adhocutil  	<library>slicer-xml @@ -53,7 +53,7 @@ run  	<library>../compile//icespider-compile  	<implicit-dependency>../compile//icespider-compile  	<include>. -	<implicit-dependency>test-api +	<implicit-dependency>test-api-lib  	: testCompile :  	; @@ -79,9 +79,11 @@ run  	xslt/transform.xslt  	:  	<define>BOOST_TEST_DYN_LINK -	<icespider>../compile//icespider +	<toolset>gcc:<icespider>../compile//icespider/<toolset>gcc +	<toolset>clang:<icespider>../compile//icespider/<toolset>clang +	<toolset>tidy:<icespider>../compile//icespider/<toolset>gcc  	<library>testCommon -	<library>test-api +	<library>test-api-lib  	<library>adhocutil  	<library>slicer  	<library>slicer-json @@ -92,22 +94,27 @@ run  	<library>../xslt//icespider-xslt  	<library>../testing//icespider-testing  	<implicit-dependency>../common//icespider-common -	<implicit-dependency>test-api -	<dependency>../compile +	<implicit-dependency>test-api-lib +	<toolset>gcc:<dependency>../compile//icespider/<toolset>gcc +	<toolset>clang:<dependency>../compile//icespider/<toolset>clang +	<toolset>tidy:<dependency>../compile//icespider/<toolset>gcc  	<include>.  	: testApp ; +obj test-fcgi : test-fcgi.ice : <toolset>tidy:<checker>none ;  run  	testFcgi.cpp  	test-fcgi.ice +	test-fcgi  	../fcgi/cgiRequestBase.cpp  	: : : -	<slicer>yes +	<slicer>pure  	<define>BOOST_TEST_DYN_LINK  	<library>testCommon  	<library>../common//icespider-common  	<library>../core//icespider-core  	<implicit-dependency>../core//icespider-core +	<implicit-dependency>test-fcgi  	<library>stdc++fs  	<library>slicer  	<library>slicer-json @@ -129,15 +136,18 @@ run  	<implicit-dependency>../core//icespider-core  	; -lib test-api : +obj test-api : test-api.ice : <include>. <toolset>tidy:<checker>none ; +lib test-api-lib :  	test-api.ice  	test-api-impl.cpp +	test-api  	: -	<slicer>yes +	<slicer>pure  	<library>slicer  	<library>adhocutil  	<library>..//pthread  	<library>..//Ice +	<implicit-dependency>test-api  	<include>.  	; diff --git a/icespider/unittests/testRoutes.json b/icespider/unittests/testRoutes.json index 7d3b10f..e3f2298 100644 --- a/icespider/unittests/testRoutes.json +++ b/icespider/unittests/testRoutes.json @@ -69,12 +69,7 @@  		"itemWithDefault":{  			"path": "/item/{s}/{i}",  			"method": "GET", -			"operation": "TestIceSpider.TestApi.withParams", -			"params": { -				"i": { -					"default": "1234" -				} -			} +			"operation": "TestIceSpider.TestApi.withParams"  		},  		"mashStruct": {  			"path": "/mashS/{s}/{t}/{i}",  | 
