Skip to content

Commit 8a61eb3

Browse files
committed
Update
1 parent b20932d commit 8a61eb3

9 files changed

+149
-67
lines changed

.clang-tidy

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
Checks: >
2+
-clang-analyzer-core.NonNullParamChecker,
3+
-clang-analyzer-optin.cplusplus.UninitializedObject,
4+
abseil-duration-*,
5+
abseil-faster-strsplit-delimiter,
6+
abseil-no-namespace,
7+
abseil-redundant-strcat-calls,
8+
abseil-str-cat-append,
9+
abseil-string-find-startswith,
10+
abseil-upgrade-duration-conversions,
11+
bugprone-assert-side-effect,
12+
bugprone-unused-raii,
13+
bugprone-use-after-move,
14+
clang-analyzer-core.DivideZero,
15+
misc-unused-using-decls,
16+
modernize-deprecated-headers,
17+
modernize-loop-convert,
18+
modernize-make-shared,
19+
modernize-make-unique,
20+
# modernize-return-braced-init-list,
21+
modernize-use-default-member-init,
22+
modernize-use-equals-default,
23+
modernize-use-nullptr,
24+
modernize-use-override,
25+
modernize-use-using,
26+
performance-faster-string-find,
27+
performance-for-range-copy,
28+
performance-inefficient-algorithm,
29+
performance-inefficient-vector-operation,
30+
performance-noexcept-move-constructor,
31+
performance-move-constructor-init,
32+
performance-type-promotion-in-math-fn,
33+
performance-unnecessary-copy-initialization,
34+
readability-container-size-empty,
35+
readability-identifier-naming,
36+
readability-redundant-control-flow,
37+
readability-redundant-member-init,
38+
readability-redundant-smartptr-get,
39+
readability-redundant-string-cstr
40+
41+
CheckOptions:
42+
- key: cppcoreguidelines-unused-variable.IgnorePattern
43+
value: "^_$"
44+
- key: bugprone-assert-side-effect.AssertMacros
45+
value: 'ASSERT'
46+
- key: bugprone-dangling-handle.HandleClasses
47+
value: 'std::basic_string_view;std::experimental::basic_string_view;absl::string_view'
48+
- key: modernize-use-auto.MinTypeNameLength
49+
value: '10'
50+
- key: readability-identifier-naming.ClassCase
51+
value: 'lower_case'
52+
- key: readability-identifier-naming.EnumCase
53+
value: 'CamelCase'
54+
- key: readability-identifier-naming.EnumConstantCase
55+
value: 'lower_case'
56+
# Ignore GoogleTest function macros.
57+
- key: readability-identifier-naming.FunctionIgnoredRegexp
58+
# To have the regex chomped correctly fence all items with `|` (other than first/last)
59+
value: >-
60+
(^AbslHashValue$|
61+
|^called_count$|
62+
|^case_sensitive$|
63+
|^Create$|
64+
|^envoy_resolve_dns$|
65+
|^evconnlistener_free$|
66+
|^event_base_free$|
67+
|^(get|set)EVP_PKEY$|
68+
|^has_value$|
69+
|^Ip6(ntohl|htonl)$|
70+
|^get_$|
71+
|^HeaderHasValue(Ref)?$|
72+
|^HeaderValueOf$|
73+
|^Is(Superset|Subset)OfHeaders$|
74+
|^LLVMFuzzerInitialize$|
75+
|^LLVMFuzzerTestOneInput$|
76+
|^Locality$|
77+
|^MOCK_METHOD$|
78+
|^PrepareCall$|
79+
|^PrintTo$|
80+
|^resolve_dns$|
81+
|^result_type$|
82+
|Returns(Default)?WorkerId$|
83+
|^sched_getaffinity$|
84+
|^shutdownThread_$|
85+
|TEST|
86+
|^use_count$)
87+
- key: readability-identifier-naming.VariableCase
88+
value: 'lower_case'
89+
- key: readability-identifier-naming.ClassCase
90+
value: 'CamelCase'
91+
- key: readability-identifier-naming.ParameterCase
92+
value: 'lower_case'
93+
- key: readability-identifier-naming.ParameterIgnoredRegexp
94+
value: >-
95+
(^cname_ttl_$|
96+
|^_.*$|
97+
|^.*limitK$|
98+
|^.*limitM$)
99+
- key: readability-identifier-naming.PrivateMemberCase
100+
value: 'lower_case'
101+
# - key: readability-identifier-naming.PrivateMemberSuffix
102+
# value: '_'
103+
- key: readability-identifier-naming.StructCase
104+
value: 'CamelCase'
105+
- key: readability-identifier-naming.TypeAliasCase
106+
value: 'lower_case'
107+
- key: readability-identifier-naming.TypeAliasIgnoredRegexp
108+
value: '(result_type)'
109+
- key: readability-identifier-naming.UnionCase
110+
value: 'CamelCase'
111+
- key: readability-identifier-naming.FunctionCase
112+
value: 'lower_case'
113+
- key: readability-identifier-naming.FunctionIgnoredRegexp
114+
value: >-
115+
(^.*nVars.*$|
116+
|^.*limitK$|
117+
|^.*limitM$)
118+
119+
HeaderFilterRegex: '^./source/.*|^./contrib/.*|^./test/.*|^./envoy/.*'
120+
121+
UseColor: true
122+
123+
WarningsAsErrors: ''
124+
125+
## The version here is arbitrary since any change to this file will
126+
## trigger a full run of clang-tidy against all files.
127+
## It can be useful as it seems some header changes may not trigger the
128+
## expected rerun.
129+
# v0

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ pycrypto.*egg-info
3535
node_modules
3636
ml-data
3737
fuzz
38+
pycryptosat.egg-info
39+
compile_commands.json

CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ if(POLICY CMP0048)
3333
cmake_policy(SET CMP0048 NEW)
3434
endif()
3535

36-
3736
if(POLICY CMP0022)
3837
cmake_policy(SET CMP0022 NEW)
3938
endif()
@@ -56,7 +55,6 @@ endif()
5655
# -----------------------------------------------------------------------------
5756
set(CRYPTOMS_SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
5857

59-
6058
# -----------------------------------------------------------------------------
6159
# Make RelWithDebInfo the default build type if otherwise not set
6260
# -----------------------------------------------------------------------------

src/Vec.h

+1-10
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,21 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1818
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
**************************************************************************************************/
2020

21-
#ifndef Vec_h
22-
#define Vec_h
21+
#pragma once
2322

2423
#include <cassert>
2524
#include <new>
2625
#include <cstdint>
2726
#include <limits>
2827
#include <utility>
2928

30-
#include "constants.h"
31-
#include "XAlloc.h"
32-
3329
using std::numeric_limits;
3430

3531
namespace CMSat {
3632

3733
class Watched;
3834

39-
//=================================================================================================
4035
// Automatically resizable arrays
41-
//
4236
// NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with realloc)
4337

4438
template<class T>
@@ -324,7 +318,4 @@ inline void vec<Watched>::clear(bool dealloc)
324318
}
325319
}
326320

327-
//=================================================================================================
328321
}
329-
330-
#endif

src/XAlloc.h

-47
This file was deleted.

src/cms_windows_includes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ THE SOFTWARE.
2727
#define _SCL_SECURE_NO_WARNINGS
2828

2929
#include <intrin.h>
30-
#include "stdint.h"
30+
#include <cstdint>
3131

3232
#if !defined(INTMAX_MAX)
3333
#define INTMAX_MAX _I32_MAX

src/cryptominisat.h

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ THE SOFTWARE.
2929
#include <string>
3030
#include <limits>
3131
#include <cstdio>
32-
#include <complex>
3332
#include <gmpxx.h>
3433
#include "solvertypesmini.h"
3534

src/solvertypesmini.h

+16-5
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
THE SOFTWARE.
2121
***********************************************/
2222

23-
#ifndef SOLVERTYPESMINI_H
24-
#define SOLVERTYPESMINI_H
23+
#ifndef SOLVERTYPESMINI__H
24+
#define SOLVERTYPESMINI__H
2525

2626
#include <cstdint>
2727
#include <iostream>
@@ -441,7 +441,6 @@ class Field {
441441
// A method to display the value (for demonstration purposes)
442442
virtual std::ostream& display(std::ostream& os) const = 0;
443443

444-
445444
static void skip_whitespace(const std::string& str, uint32_t& at) {
446445
char c = str[at];
447446
while (c == '\t' || c == '\r' || c == ' ') {
@@ -514,6 +513,7 @@ class FieldGen {
514513
virtual std::unique_ptr<Field> zero() const = 0;
515514
virtual std::unique_ptr<Field> one() const = 0;
516515
virtual std::unique_ptr<FieldGen> dup() const = 0;
516+
virtual bool larger_than(const Field&, const Field&) const = 0;
517517
virtual bool weighted() const = 0;
518518
};
519519

@@ -620,6 +620,12 @@ class FGenDouble : public FieldGen {
620620
return std::make_unique<FGenDouble>();
621621
}
622622

623+
bool larger_than(const Field& a, const Field& b) const override {
624+
const auto& ad = dynamic_cast<const FDouble&>(a);
625+
const auto& bd = dynamic_cast<const FDouble&>(b);
626+
return ad.val > bd.val;
627+
}
628+
623629
bool weighted() const override { return true; }
624630
};
625631

@@ -715,10 +721,15 @@ class FGenMpz : public FieldGen {
715721
return std::make_unique<FGenMpz>();
716722
}
717723

724+
bool larger_than(const Field& a, const Field& b) const override {
725+
const auto& ad = dynamic_cast<const FMpz&>(a);
726+
const auto& bd = dynamic_cast<const FMpz&>(b);
727+
return ad.val > bd.val;
728+
}
729+
718730
bool weighted() const override { return false; }
719731
};
720732

721-
722733
}
723734

724-
#endif //SOLVERTYPESMINI_H
735+
#endif

tests/assump_test.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ THE SOFTWARE.
2222

2323
#include "gtest/gtest.h"
2424

25-
#include "cryptominisat5/cryptominisat.h"
2625
#include "src/solverconf.h"
2726
#include "test_helper.h"
2827
#include <vector>

0 commit comments

Comments
 (0)