Skip to content

Commit

Permalink
Merge pull request #10 from klassen-software-solutions/development/v1
Browse files Browse the repository at this point in the history
Makes the static analyzer recognize the change in flow
  • Loading branch information
stevenklassen8376 authored Dec 26, 2019
2 parents 91834bf + 80d3814 commit 6a196c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion BuildSystem/license_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ def _merge_prereq_dependancies(licenses: Dict, prereq: str):
for entry in data['dependencies']:
key = entry['moduleName']
if key in licenses:
bisect.insort(licenses[key]['x-usedBy'], key)
for usedby in entry['x-usedBy']:
if usedby not in licenses[key]['x-usedBy']:
bisect.insort(licenses[key]['x-usedBy'], usedby)
else:
licenses[key] = entry

Expand Down
10 changes: 10 additions & 0 deletions Sources/contract.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef ksscontract_contract_hpp
#define ksscontract_contract_hpp

#include <cassert>
#include <initializer_list>
#include <string>

Expand All @@ -33,6 +34,10 @@ namespace kss { namespace contract {

inline void precondition(const Expression& exp) {
performTerminatingCheck("Precondition", exp);
#if defined(__clang_analyzer__)
// This is used to make the static analyzer recognize the change in the flow.
assert(exp.result);
#endif
}

inline void condition(const Expression& exp) {
Expand All @@ -51,6 +56,11 @@ namespace kss { namespace contract {
*/
# define KSS_EXPR(expr) kss::contract::_private::Expression {(expr), #expr, __PRETTY_FUNCTION__, __FILE__, __LINE__}

#if defined(__clang_analyzer__)
// This is used to make the static analyzer recognize the change in the flow.
# undef KSS_EXPR
# define KSS_EXPR(expr) (static_cast<void>(assert(expr)), kss::contract::_private::Expression {(expr), #expr, __PRETTY_FUNCTION__, __FILE__, __LINE__})
#endif

/*!
The parameter check is a form of precondition that is presumed to be checking
Expand Down
1 change: 1 addition & 0 deletions Sources/invariant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef ksscontract_invariant_hpp
#define ksscontract_invariant_hpp

#include <exception>
#include <functional>
#include <string>
#include <typeinfo>
Expand Down

0 comments on commit 6a196c0

Please sign in to comment.