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
54fcea5
Remove the (void) parameter lists
zayenz Nov 5, 2026
db87fce
Enable the clang-tidy checks that already pass
zayenz Nov 6, 2026
f3423e1
Round the TSP distances with llround
zayenz Nov 6, 2026
9d3d1f0
Reject reserved identifiers
zayenz Nov 6, 2026
070ff03
Enable the pointer iteration order check
zayenz Nov 6, 2026
d7c9550
Copy region heap blocks with std::copy_n
zayenz Nov 6, 2026
bcb7a41
Compare strcmp results explicitly
zayenz Nov 6, 2026
15d0760
Mark the deliberate grandparent calls in set LDSB
zayenz Nov 6, 2026
4a21791
Make the CRTP base constructors private
zayenz Nov 6, 2026
b3d4515
Move assignments out of if conditions
zayenz Nov 6, 2026
23ab2c5
Return a non-const reference to *this from assignment
zayenz Nov 6, 2026
e0cd48a
Handle self-assignment explicitly
zayenz Nov 6, 2026
b8cb5a3
Point at const data in the sparse tuple loops
zayenz Nov 6, 2026
0c5e33e
Define header functions and variables inline
zayenz Nov 6, 2026
d581eec
Drop the anonymous namespace from the cumulatives header
zayenz Nov 6, 2026
8db42d1
Keep overrides at the visibility of the base
zayenz Nov 6, 2026
740bb23
Remove expressions with equivalent operands
zayenz Nov 6, 2026
17451c9
Say why catch blocks are empty
zayenz Nov 6, 2026
fee1f51
Enable the exception escape check for destructors
zayenz Nov 6, 2026
a6a011e
Drop static from anonymous namespaces
zayenz Nov 6, 2026
02edb43
Test containers with empty
zayenz Nov 6, 2026
bcaca34
Test membership with contains
zayenz Nov 6, 2026
fbfac43
Remove casts to the same type
zayenz Nov 6, 2026
d021273
Use ifdef and ifndef for single macros
zayenz Nov 6, 2026
305a1c2
Call static members through their class
zayenz Nov 6, 2026
ed24990
Remove redundant member initializers
zayenz Nov 6, 2026
5b8f7ab
Remove redundant parentheses
zayenz Nov 6, 2026
92d3786
Remove empty string initializers
zayenz Nov 6, 2026
c85c940
Remove const from returned values
zayenz Nov 6, 2026
46fa56c
Remove const from parameters in declarations
zayenz Nov 6, 2026
8d3d9a3
Use data() for the address of container contents
zayenz Nov 6, 2026
a34500d
Remove redundant control flow
zayenz Nov 6, 2026
f01ba3d
Write literal suffixes in upper case
zayenz Nov 6, 2026
001e7c4
Spell out auto pointers
zayenz Nov 6, 2026
9b276c1
Remove redundant smart pointer get calls
zayenz Nov 6, 2026
805a20e
Clamp with std::min and std::max
zayenz Nov 6, 2026
b1ab71c
Do not return void expressions
zayenz Nov 6, 2026
e36c7d5
Brace the branches of an if consistently
zayenz Nov 6, 2026
7943f5b
Remove repeated access specifiers
zayenz Nov 6, 2026
edef189
Use the trait aliases and variable templates
zayenz Nov 6, 2026
201eff6
Create unique pointers with make_unique
zayenz Nov 6, 2026
f157b4a
Create shared pointers with make_shared
zayenz Nov 6, 2026
b1235b4
Construct container elements in place
zayenz Nov 6, 2026
f10c5d4
Use raw string literals for escaped text
zayenz Nov 6, 2026
c7d7238
Use starts_with and ends_with
zayenz Nov 6, 2026
e60cee9
Use range-based for loops
zayenz Nov 6, 2026
48a0551
Keep generated tables free of redundant expressions
zayenz Nov 6, 2026
faffacb
Default special members made trivial by earlier changes
zayenz Nov 6, 2026
2bd5924
Compare mixed-sign integers with std::cmp functions
zayenz Nov 6, 2026
867b164
Replace typedef with using
zayenz Nov 6, 2026
312eb12
Drop typename where C++20 no longer needs it
zayenz Nov 6, 2026
11577c8
Use range algorithms
zayenz Nov 6, 2026
5675f6c
Use transparent functors
zayenz Nov 6, 2026
2d66e16
Use initializer lists for nested min and max
zayenz Nov 6, 2026
9f3dee2
Constrain the Boolean expression templates with a concept
zayenz Nov 6, 2026
d2f4653
Take read-only array parameters as pointers to const
zayenz Nov 6, 2026
27740bc
Drop else after return
zayenz Nov 6, 2026
942125e
Simplify Boolean returns and assignments
zayenz Nov 6, 2026
5d8203a
Use the same parameter names in declarations and definitions
zayenz Nov 6, 2026
eca3063
Check call arguments for likely swaps
zayenz Nov 6, 2026
a771ac3
Use nested namespace definitions
zayenz Nov 6, 2026
8fae42e
Replace C-style casts
zayenz Nov 6, 2026
fd73c16
Make the LDSB test helper a variadic template
zayenz Nov 6, 2026
0be41fa
Enable checks from other groups that already pass
zayenz Nov 6, 2026
f624dc4
Keep malloc inside the heap allocator
zayenz Nov 6, 2026
9cda3ec
Remove the default argument from a virtual function
zayenz Nov 6, 2026
7b32d47
Discard unused C library results explicitly
zayenz Nov 6, 2026
96dec4e
Check that rvalue reference parameters are moved
zayenz Nov 6, 2026
05fe644
Derive exceptions from std::exception
zayenz Nov 6, 2026
681f7f2
Give BranchPlugin a virtual destructor
zayenz Nov 6, 2026
a336efd
Give file-local functions internal linkage
zayenz Nov 6, 2026
e0bb0d1
Enable the analyzer groups that fit
zayenz Nov 7, 2026
abf9963
Fix what the full lint found in sources and headers
zayenz Nov 7, 2026
0170c27
Lint the FlatZinc parser and lexer actions
zayenz Nov 7, 2026
171e512
Document the clang-tidy check selection
zayenz Nov 7, 2026
1770c8f
Remove a stray blank line from the unary test
zayenz Nov 7, 2026
2295b97
Define NOMINMAX for the blackbox executable
zayenz Nov 7, 2026
d5b73f1
Note why the matrix slice conversion is qualified
zayenz Nov 7, 2026
b45d374
Record the zdev areas for the Gecode 7 changes
zayenz Nov 20, 2026
082e7d7
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