Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ Rank: minor
Remove Qt 5 support. Gist and the Qt-backed FlatZinc features now
require Qt 6.

[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