Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
14577ff
Remove the (void) parameter lists
zayenz Nov 5, 2026
bec0424
Enable the clang-tidy checks that already pass
zayenz Nov 6, 2026
ef1fa65
Round the TSP distances with llround
zayenz Nov 6, 2026
432730b
Reject reserved identifiers
zayenz Nov 6, 2026
233ecde
Enable the pointer iteration order check
zayenz Nov 6, 2026
433000c
Copy region heap blocks with std::copy_n
zayenz Nov 6, 2026
5385a69
Compare strcmp results explicitly
zayenz Nov 6, 2026
1488248
Mark the deliberate grandparent calls in set LDSB
zayenz Nov 6, 2026
9d28da9
Make the CRTP base constructors private
zayenz Nov 6, 2026
f59dd7a
Move assignments out of if conditions
zayenz Nov 6, 2026
d6fae69
Return a non-const reference to *this from assignment
zayenz Nov 6, 2026
bf87c96
Handle self-assignment explicitly
zayenz Nov 6, 2026
5f859d7
Point at const data in the sparse tuple loops
zayenz Nov 6, 2026
e95b61b
Define header functions and variables inline
zayenz Nov 6, 2026
99b6073
Drop the anonymous namespace from the cumulatives header
zayenz Nov 6, 2026
b76fed2
Keep overrides at the visibility of the base
zayenz Nov 6, 2026
721995e
Remove expressions with equivalent operands
zayenz Nov 6, 2026
f64e995
Say why catch blocks are empty
zayenz Nov 6, 2026
c5e7df9
Enable the exception escape check for destructors
zayenz Nov 6, 2026
e658b76
Drop static from anonymous namespaces
zayenz Nov 6, 2026
9fb4a5a
Test containers with empty
zayenz Nov 6, 2026
2073865
Test membership with contains
zayenz Nov 6, 2026
fb20a39
Remove casts to the same type
zayenz Nov 6, 2026
6fd00bf
Use ifdef and ifndef for single macros
zayenz Nov 6, 2026
8fb9946
Call static members through their class
zayenz Nov 6, 2026
1276ead
Remove redundant member initializers
zayenz Nov 6, 2026
dc6fb7c
Remove redundant parentheses
zayenz Nov 6, 2026
8051812
Remove empty string initializers
zayenz Nov 6, 2026
730d23f
Remove const from returned values
zayenz Nov 6, 2026
acb3c50
Remove const from parameters in declarations
zayenz Nov 6, 2026
368d61d
Use data() for the address of container contents
zayenz Nov 6, 2026
57d0f6c
Remove redundant control flow
zayenz Nov 6, 2026
6f1e24e
Write literal suffixes in upper case
zayenz Nov 6, 2026
3cc20b9
Spell out auto pointers
zayenz Nov 6, 2026
a2046c0
Remove redundant smart pointer get calls
zayenz Nov 6, 2026
5346421
Clamp with std::min and std::max
zayenz Nov 6, 2026
82a11b3
Do not return void expressions
zayenz Nov 6, 2026
7db0148
Brace the branches of an if consistently
zayenz Nov 6, 2026
4e483d1
Remove repeated access specifiers
zayenz Nov 6, 2026
91da886
Use the trait aliases and variable templates
zayenz Nov 6, 2026
2d50006
Create unique pointers with make_unique
zayenz Nov 6, 2026
5cd890a
Create shared pointers with make_shared
zayenz Nov 6, 2026
3e27292
Construct container elements in place
zayenz Nov 6, 2026
583b6f5
Use raw string literals for escaped text
zayenz Nov 6, 2026
50b7142
Use starts_with and ends_with
zayenz Nov 6, 2026
1bd18a4
Use range-based for loops
zayenz Nov 6, 2026
bf56317
Keep generated tables free of redundant expressions
zayenz Nov 6, 2026
4086f08
Default special members made trivial by earlier changes
zayenz Nov 6, 2026
a18dd09
Compare mixed-sign integers with std::cmp functions
zayenz Nov 6, 2026
ca6a6c6
Replace typedef with using
zayenz Nov 6, 2026
b0d50ce
Drop typename where C++20 no longer needs it
zayenz Nov 6, 2026
011458c
Use range algorithms
zayenz Nov 6, 2026
ef566bf
Use transparent functors
zayenz Nov 6, 2026
4cea0be
Use initializer lists for nested min and max
zayenz Nov 6, 2026
0532802
Constrain the Boolean expression templates with a concept
zayenz Nov 6, 2026
492f36c
Take read-only array parameters as pointers to const
zayenz Nov 6, 2026
0f962e9
Drop else after return
zayenz Nov 6, 2026
29c1ebe
Simplify Boolean returns and assignments
zayenz Nov 6, 2026
77e5c7a
Use the same parameter names in declarations and definitions
zayenz Nov 6, 2026
8b1151f
Check call arguments for likely swaps
zayenz Nov 6, 2026
9b0bcb6
Use nested namespace definitions
zayenz Nov 6, 2026
e19700b
Replace C-style casts
zayenz Nov 6, 2026
cd137ca
Make the LDSB test helper a variadic template
zayenz Nov 6, 2026
ec50088
Enable checks from other groups that already pass
zayenz Nov 6, 2026
b186581
Keep malloc inside the heap allocator
zayenz Nov 6, 2026
35406e6
Remove the default argument from a virtual function
zayenz Nov 6, 2026
0274d64
Discard unused C library results explicitly
zayenz Nov 6, 2026
7ab9ee5
Check that rvalue reference parameters are moved
zayenz Nov 6, 2026
f46aac8
Derive exceptions from std::exception
zayenz Nov 6, 2026
f1a115e
Give BranchPlugin a virtual destructor
zayenz Nov 6, 2026
54a1ea7
Give file-local functions internal linkage
zayenz Nov 6, 2026
bb1d7d5
Enable the analyzer groups that fit
zayenz Nov 7, 2026
22693aa
Fix what the full lint found in sources and headers
zayenz Nov 7, 2026
5d4e1ec
Lint the FlatZinc parser and lexer actions
zayenz Nov 7, 2026
39ab630
Document the clang-tidy check selection
zayenz Nov 7, 2026
407051a
Remove a stray blank line from the unary test
zayenz Nov 7, 2026
51d2691
Define NOMINMAX for the blackbox executable
zayenz Nov 7, 2026
8ff5934
Note why the matrix slice conversion is qualified
zayenz Nov 7, 2026
246ed1f
Record the zdev areas for the Gecode 7 changes
zayenz Nov 20, 2026
6b473d8
Remove the zdev records from the pull request
zayenz Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
131 changes: 98 additions & 33 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,39 +1,88 @@
# Use clang-tidy 22. Keep checks focused on correctness and useful modernization.
# Use clang-tidy 22. Each group below is enabled as a whole, and a line that
# starts with a minus excludes a check that was tried and does not fit. The
# reasons are in docs/code-style.md. Checks from other groups are named one by
# one, because most of those groups are aliases of checks enabled here.
Checks: >-
-*,
clang-analyzer-core.*,
bugprone-assert-side-effect,
bugprone-dangling-handle,
bugprone-inaccurate-erase,
bugprone-integer-division,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-sizeof-expression,
bugprone-suspicious-memory-comparison,
bugprone-suspicious-memset-usage,
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-use-after-move,
bugprone-virtual-near-miss,
modernize-deprecated-headers,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-nullptr,
modernize-use-override,
performance-avoid-endl,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
performance-no-automatic-move,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
readability-identifier-naming
clang-analyzer-cplusplus.*,
-clang-analyzer-cplusplus.NewDeleteLeaks,
clang-analyzer-deadcode.*,
clang-analyzer-nullability.*,
clang-analyzer-optin.*,
-clang-analyzer-optin.core.EnumCastOutOfRange,
-clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-optin.performance.Padding,
clang-analyzer-security.*,
-clang-analyzer-security.ArrayBound,
clang-analyzer-unix.*,
-clang-analyzer-unix.Malloc,
clang-analyzer-valist.*,
cert-err33-c,
google-default-arguments,
cppcoreguidelines-no-malloc,
cppcoreguidelines-rvalue-reference-param-not-moved,
cppcoreguidelines-misleading-capture-default-by-value,
cppcoreguidelines-missing-std-forward,
google-build-explicit-make-pair,
google-global-names-in-headers,
hicpp-exception-baseclass,
bugprone-*,
-bugprone-branch-clone,
-bugprone-derived-method-shadowing-base-method,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-inc-dec-in-conditions,
-bugprone-macro-parentheses,
-bugprone-multi-level-implicit-pointer-conversion,
-bugprone-narrowing-conversions,
-bugprone-signed-char-misuse,
-bugprone-switch-missing-default-case,
-bugprone-throwing-static-initialization,
-bugprone-unchecked-string-to-number-conversion,
concurrency-*,
-concurrency-mt-unsafe,
misc-*,
-misc-confusable-identifiers,
-misc-const-correctness,
-misc-header-include-cycle,
-misc-include-cleaner,
-misc-multiple-inheritance,
-misc-new-delete-overloads,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-static-assert,
-misc-use-anonymous-namespace,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-pass-by-value,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-default-member-init,
-modernize-use-designated-initializers,
-modernize-use-nodiscard,
-modernize-use-std-numbers,
-modernize-use-trailing-return-type,
performance-*,
-performance-enum-size,
-performance-no-int-to-ptr,
portability-*,
-portability-template-virtual-member-function,
readability-*,
-readability-avoid-nested-conditional-operator,
-readability-braces-around-statements,
-readability-convert-member-functions-to-static,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-make-member-function-const,
-readability-math-missing-parentheses,
-readability-named-parameter,
-readability-redundant-declaration,
-readability-use-anyofallof
WarningsAsErrors: '*'
HeaderFilterRegex: '(gecode|test|examples|tools)/'
ExcludeHeaderFilterRegex: 'gecode/flatzinc/(parser\.tab\.(cpp|hpp)|lexer\.yy\.cpp)$'
Expand All @@ -42,6 +91,22 @@ FormatStyle: file
CheckOptions:
# Explicit discards document intentional ownership handoffs.
bugprone-unused-return-value.AllowCastToVoid: true
bugprone-empty-catch.IgnoreCatchWithKeywords: 'Expected;Ignored'
# main reports nothing useful by catching, and the move members this
# reports are implicit ones of value types and lambdas.
bugprone-exception-escape.CheckMain: false
bugprone-exception-escape.CheckMoveMemberFunctions: false
# glibc needs this feature macro defined before any system header.
bugprone-reserved-identifier.AllowedIdentifiers: '_GNU_SOURCE'
cert-err33-c.AllowCastToVoid: true
# Checking functions finds the real cases; classes and test registration
# objects in .cpp files would only need wrapping in anonymous namespaces.
misc-use-internal-linkage.AnalyzeTypes: false
misc-use-internal-linkage.AnalyzeVariables: false
# De Morgan rewrites do not make these conditions easier to read.
readability-simplify-boolean-expr.SimplifyDeMorgan: false
# Sites without a fix-it declare variables in the condition.
readability-else-after-return.WarnOnUnfixable: false
readability-identifier-naming.FunctionCase: lower_case
readability-identifier-naming.MethodCase: lower_case
readability-identifier-naming.VariableCase: lower_case
Expand Down
2 changes: 1 addition & 1 deletion .github/ci/32-bit-linkage-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ EOF
cat > "$consumer_dir/main.cpp" <<'EOF'
#include <gecode/search.hh>

int main(void) {
int main() {
Gecode::Search::Statistics statistics;
Gecode::Search::Options options;

Expand Down
2 changes: 1 addition & 1 deletion .github/ci/cmake-consumer-smoke-msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cat > "$work/main.cpp" <<'EOF'
#include <gecode/int.hh>
#include <gecode/support/config.hpp>

int main(void) {
int main() {
Gecode::IntArgs values(1);
values[0] = 0;
return values[0];
Expand Down
6 changes: 3 additions & 3 deletions .github/ci/cmake-consumer-smoke-vcpkg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ target_link_libraries(consumer_a PRIVATE Gecode::gecode)
'@ | Set-Content -Encoding utf8 (Join-Path $work "a\CMakeLists.txt")
@'
#include <gecode/support/config.hpp>
int main(void) { return 0; }
int main() { return 0; }
'@ | Set-Content -Encoding utf8 (Join-Path $work "a\main.cpp")

@'
Expand All @@ -61,7 +61,7 @@ target_link_libraries(consumer_b PRIVATE Gecode::gecodedriver)
'@ | Set-Content -Encoding utf8 (Join-Path $work "b\CMakeLists.txt")
@'
#include <gecode/driver.hh>
int main(void) {
int main() {
Gecode::Options options("consumer_b");
return options.model();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ target_link_libraries(consumer_d PRIVATE Gecode::gecodefloat)
#error "Expected installed Gecode package to enable MPFR"
#endif
#include <gecode/float.hh>
int main(void) {
int main() {
Gecode::Float::Rounding rounding;
return rounding.exp_down(1.0) > 0.0 ? 0 : 1;
}
Expand Down
6 changes: 3 additions & 3 deletions .github/ci/cmake-consumer-smoke.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ target_link_libraries(consumer_a PRIVATE Gecode::gecode)
'@ | Set-Content -Encoding utf8 (Join-Path $work "a\CMakeLists.txt")
@'
#include <gecode/support/config.hpp>
int main(void) { return 0; }
int main() { return 0; }
'@ | Set-Content -Encoding utf8 (Join-Path $work "a\main.cpp")

@'
Expand All @@ -46,7 +46,7 @@ target_link_libraries(consumer_b PRIVATE Gecode::gecodedriver)
'@ | Set-Content -Encoding utf8 (Join-Path $work "b\CMakeLists.txt")
@'
#include <gecode/driver.hh>
int main(void) {
int main() {
Gecode::Options options("consumer_b");
return options.model();
}
Expand Down Expand Up @@ -131,7 +131,7 @@ target_link_libraries(manual_consumer PRIVATE "${GECODE_SUPPORT_LIBRARY}")
'@ | Set-Content -Encoding utf8 (Join-Path $work "manual\CMakeLists.txt")
@'
#include <gecode/support.hh>
int main(void) {
int main() {
(void) Gecode::Support::hwrnd();
return 0;
}
Expand Down
14 changes: 7 additions & 7 deletions .github/ci/cmake-consumer-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ target_link_libraries(consumer_a PRIVATE Gecode::gecode)
EOF
cat > "$work/a/main.cpp" <<'EOF'
#include <gecode/support/config.hpp>
int main(void) { return 0; }
int main() { return 0; }
EOF

cat > "$work/b/CMakeLists.txt" <<'EOF'
Expand All @@ -70,7 +70,7 @@ target_link_libraries(consumer_b PRIVATE Gecode::gecodedriver)
EOF
cat > "$work/b/main.cpp" <<'EOF'
#include <gecode/driver.hh>
int main(void) {
int main() {
Gecode::Options options("consumer_b");
return options.model();
}
Expand Down Expand Up @@ -116,7 +116,7 @@ cat > "$work/d/main.cpp" <<'EOF'
#error "Expected installed Gecode package to enable MPFR"
#endif
#include <gecode/float.hh>
int main(void) {
int main() {
Gecode::Float::Rounding rounding;
return rounding.exp_down(1.0) > 0.0 ? 0 : 1;
}
Expand Down Expand Up @@ -145,7 +145,7 @@ cat > "$work/e/main.cpp" <<'EOF'
#error "Expected installed Gecode package to enable MPFR"
#endif
#include <gecode/float.hh>
int main(void) {
int main() {
Gecode::Float::Rounding rounding;
return rounding.log_down(2.0) >= 0.0 ? 0 : 1;
}
Expand All @@ -172,7 +172,7 @@ target_link_libraries(consumer_f PRIVATE ${Gecode_LIBRARIES})
EOF
cat > "$work/f/main.cpp" <<'EOF'
#include <gecode/support.hh>
int main(void) { return Gecode::Support::Thread::npu() > 0 ? 0 : 1; }
int main() { return Gecode::Support::Thread::npu() > 0 ? 0 : 1; }
EOF

cat > "$work/g/CMakeLists.txt" <<'EOF'
Expand Down Expand Up @@ -209,7 +209,7 @@ target_link_libraries(consumer_j PRIVATE ${Gecode_LIBRARIES})
EOF
cat > "$work/j/main.cpp" <<'EOF'
#include <gecode/gist.hh>
int main(void) { return 0; }
int main() { return 0; }
EOF

cat > "$work/k/CMakeLists.txt" <<'EOF'
Expand All @@ -228,7 +228,7 @@ target_link_libraries(consumer_k PRIVATE ${Gecode_LIBRARIES})
EOF
cat > "$work/k/main.cpp" <<'EOF'
#include <gecode/float.hh>
int main(void) { Gecode::Float::Rounding rounding; return rounding.sqrt_down(4.0) == 2.0 ? 0 : 1; }
int main() { Gecode::Float::Rounding rounding; return rounding.sqrt_down(4.0) == 2.0 ? 0 : 1; }
EOF

cat > "$work/l/CMakeLists.txt" <<'EOF'
Expand Down
2 changes: 1 addition & 1 deletion .github/ci/qt-gist-consumer-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ using FloatCompare = std::string (*)(const std::string&, Gecode::FloatVar, Gecod
FloatCompare float_compare = &Gecode::Gist::Comparator::compare;
#endif

int main(void) {
int main() {
#ifdef GECODE_HAS_SET_VARS
if (set_compare == nullptr)
return 1;
Expand Down
2 changes: 1 addition & 1 deletion .github/ci/qt5-gist-consumer-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ using FloatCompare = std::string (*)(const std::string&, Gecode::FloatVar, Gecod
FloatCompare float_compare = &Gecode::Gist::Comparator::compare;
#endif

int main(void) {
int main() {
#ifdef GECODE_HAS_SET_VARS
if (set_compare == nullptr)
return 1;
Expand Down
17 changes: 17 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ Date: unreleased
This release contains breaking changes. See the entries below for the
changes downstream code needs.

[ENTRY]
Module: flatzinc
What: change
Rank: minor
[DESCRIPTION]
Derive FlatZinc::Error and FlatZinc::AST::TypeError from std::exception, so that
a handler for std::exception also catches them. AST::TypeError::what now returns
const char* instead of std::string.

[ENTRY]
Module: flatzinc
What: bug
Rank: minor
[DESCRIPTION]
Give FlatZinc::BranchPlugin a virtual destructor, so that a plugin deleted
through its interface is destroyed correctly.

[ENTRY]
Module: other
What: change
Expand Down
Loading
Loading