Repository navigation
Conversation
zayenz
force-pushed
the
feature/breaking-7
branch
4 times, most recently
from
November 7, 2026 08:04
08405b4 to
bb0af29
Compare
Empty parameter lists are now (), and modernize-redundant-void-arg keeps them
so. Behaviour and casts to void are unchanged. clang-tidy covers what this
platform compiles; a byte-level pass covers the rest, and generated files
follow their inputs.
Reproduce this commit by running the following at the root of a Git tree of
the parent commit:
set -euo pipefail
llvm=/opt/homebrew/opt/llvm@22/bin
export PATH="$llvm:/opt/homebrew/opt/bison/bin:/opt/homebrew/opt/flex/bin:$PATH"
export CLANG_FORMAT="$llvm/clang-format" CLANG_TIDY="$llvm/clang-tidy"
root=$(pwd -P)
build=build/void-args
rm -rf "$build"
cmake -S . -B "$build" -G Ninja -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DGECODE_ENABLE_EXPERIMENTAL=ON \
-DGECODE_ENABLE_CBS=ON -DGECODE_ENABLE_CPPROFILER=ON \
-DGECODE_ENABLE_FAULT_INJECTION=ON -DGECODE_ENABLE_AUDIT=ON \
-DGECODE_ENABLE_GIST=ON -DGECODE_ENABLE_QT=ON
run-clang-tidy -clang-tidy-binary "$CLANG_TIDY" -p "$build" -j 10 -quiet \
-checks='-*,modernize-redundant-void-arg' -warnings-as-errors='-*' \
-extra-arg=-UNDEBUG -fix \
-header-filter "$root/(gecode|test|examples|tools)/" \
-exclude-header-filter '/gecode/flatzinc/(parser\.tab\.(cpp|hpp)|lexer\.yy\.cpp)$' \
-source-filter "^$root/(?!gecode/flatzinc/(parser\.tab\.cpp|lexer\.yy\.cpp)$)(gecode|test|examples|tools)/" \
> "$build/clang-tidy.log" 2>&1
python3 - <<'PY'
import pathlib
import re
code = {".hpp", ".cpp", ".hh", ".yxx", ".lxx"}
generated = {"parser.tab.cpp", "parser.tab.hpp", "lexer.yy.cpp"}
files = [path for top in ("gecode", "test", "examples", "tools")
for path in pathlib.Path(top).rglob("*")
if path.suffix in code and path.name not in generated
and "third-party" not in path.parts]
files += [*pathlib.Path(".github/ci").glob("*.sh"), *pathlib.Path(".github/ci").glob("*.ps1"),
pathlib.Path("misc/genvarimp.py")]
before = re.compile(rb"[\w)\]}>+\-*/=!<&|^~%][ \t]*$")
keyword = re.compile(rb"\b(?:return|else|do|sizeof|alignof|typeid|decltype|noexcept)[ \t]*$")
gap = re.compile(rb"(?:\s+|//[^\n]*\n|/\*.*?\*/)*", re.S)
after = re.compile(rb"[;{:=,)>&#]|->|(?:const|volatile|noexcept|override|final|throw|try)\b|$")
def replace(match):
text = match.string
head = text[max(match.start() - 40, 0):match.start()]
tail = gap.match(text, match.end()).end()
is_list = before.search(head) and not keyword.search(head) and after.match(text, tail)
return b"()" if is_list else match[0]
for path in sorted(files):
source = path.read_bytes()
result = re.sub(rb"\(void\)", replace, source)
if result != source:
path.write_bytes(result)
PY
python3 - <<'PY'
import pathlib
def replace(name, old, new):
path = pathlib.Path(name)
text = path.read_text()
assert text.count(old) == 1, old
path.write_text(text.replace(old, new))
replace(".clang-tidy", " modernize-deprecated-headers,\n",
" modernize-deprecated-headers,\n modernize-redundant-void-arg,\n")
replace("docs/code-style.md", "## Checking changes\n", """\
An empty parameter list is `()`, also in function pointer types and
`std::function` signatures. `(void)` is a C spelling and stays only in C
sources, where it means something different.
`modernize-redundant-void-arg` enforces the rule. A cast to `void` that discards
a value, such as `(void)new (p) T()`, is a different construct and stays.
`forceinline` stays lowercase, although it is a macro, so that it reads like
`inline`.
""")
replace("docs/breaking-7.md", "- Revisit the `forceinline` portability macro and obsolete `(void)` parameter lists.\n", "")
replace("docs/breaking-7.md", " compatibility aliases; see `code-style.md`.\n", """\
compatibility aliases; see `code-style.md`.
- Empty parameter lists are `()`, and `forceinline` keeps its lowercase name;
see `code-style.md`.
""")
PY
cmake --build "$build" --target regenerate
uv run misc/check.py format
Zdev-Change-Id: Z9b69e8fd20237843076a34a448f17e293c9f0ebb980e71dbe776ea78776d21f8
Enable the bugprone, concurrency, misc, modernize, performance, portability, and readability groups as a whole. Each check that reports something is excluded until it has been reviewed, so a later change either removes an exclusion together with its fixes, or keeps it as a decision. The three integer literal actions in lexer.lxx began on the line of the rule, which readability-misleading-indentation reports in the generated lexer.
Enable bugprone-incorrect-roundings. Adding 0.5 before truncating gives the wrong result for values just below a half.
Enable bugprone-reserved-identifier. The one report is _GNU_SOURCE, which gecode/flatzinc/blackbox-backend.cpp must define for glibc, so the check allows it.
Enable bugprone-nondeterministic-pointer-iteration-order. The one report sorts constraint pointers by argument count, which does not depend on addresses.
Enable bugprone-bitwise-pointer-cast. The memcpy copied an array of pointers but read like a cast between pointer types.
Enable bugprone-suspicious-string-compare.
Enable bugprone-parent-virtual-call. LDSBSetBrancher calls ViewValBrancher directly because the LDSB steps of its parent need its own symmetry update first, or add prunings of their own.
Enable bugprone-crtp-constructor-accessibility. SparseTupleState and BlockClient can now only be constructed by the class they were written for.
Enable bugprone-assignment-in-if-condition.
Enable misc-unconventional-assign-operator. Assignment operators that returned a const reference now return T&, and those that returned the converted result of a base assignment now call it and return *this.
Enable bugprone-unhandled-self-assignment. NaryInter and NaryUnion dropped their free list when assigned to themselves. The copy members of TaskArray only copied their fields, so they are now defaulted.
Enable misc-misplaced-const. const Tuple made the pointer const, not the tuple it points at.
Enable misc-definitions-in-headers.
Enable misc-anonymous-namespace-in-header. Cumulatives uses std::less instead of a local class. The example instance files keep theirs, since one example includes each of them.
Enable misc-override-with-different-visibility. SteelMillBranch inherited from Brancher privately by accident.
Enable misc-redundant-expression. The variable header generator wrote x ^ x into the modification event tables, and now writes 0 instead.
Enable bugprone-empty-catch. A block may stay empty when a comment says the exception is expected or ignored, which is what the tests and the blackbox library cleanup do.
Enable bugprone-exception-escape, without main and the move members. Its only reports there were main functions, which report nothing better by catching, and the implicit members of value types and lambdas. The three remaining reports are marked as false positives.
Enable readability-static-definition-in-anonymous-namespace.
Enable readability-container-size-empty.
Enable readability-container-contains. C++23 gives std::string the same member.
Enable readability-redundant-casting.
Enable readability-use-concise-preprocessor-directives.
Enable readability-static-accessed-through-instance.
Enable readability-redundant-member-init.
Enable cppcoreguidelines-rvalue-reference-param-not-moved. Only the empty branch filter and print function take an rvalue without moving it.
Enable hicpp-exception-baseclass. FlatZinc::Error, AST::TypeError, and ShapeError now provide what(), and the tests that unwind with a thrown int use std::logic_error.
Enable misc-use-internal-linkage for functions.
Enable clang-analyzer cplusplus, deadcode, nullability, optin, security, unix, and valist, except the checks that only produce false positives here. Remove the dead stores this finds, including the unused search timer in Gist.
The per-check sweeps missed these. The names in declarations and definitions now agree, and Cutoff::geometric no longer calls its scale base in the definition; it passed them in the right order all along. The cumulative tests hold their usage table in a vector, which also removes the analyzer's report on an empty allocation.
Lint stops at the first failing stage, so the grammar actions and parser.hh were reached only once everything else passed. yyerror keeps external linkage, because the lexer calls it, and is now declared once in parser.hh; the other parser functions become static. Token strings come from strdup, so one helper holds the free the check has to allow. The windows and none blackbox sources and the headers no linted source includes get the same namespace form, which a lint here cannot reach.
Record why each excluded check does not fit, so that a later review starts from the reasons, and which fix-its need care. Also restore bugprone-unused-return-value, which the switch to whole groups excluded by mistake.
Pack has a data member l, and MSVC resolves l in the out-of-line definition of calc_dff_lower_bound to that member instead of to the template parameter of the same name. Rename the parameter. This, rather than the function-typed parameter that 50707a2 changed, is what MSVC rejected. Removing the redundant parentheses around numeric_limits members in blackbox-exec.cpp exposed them to the min and max macros of windows.h, so define NOMINMAX as blackbox-backend.cpp does.
zayenz
force-pushed
the
feature/breaking-7
branch
from
November 20, 2026 09:39
bb0af29 to
58e3488
Compare
zayenz
changed the base branch from
main
to
feature/breaking-7-10-scoped-enums
November 20, 2026 09:39
This was referenced Nov 20, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the final PR of the eleven-PR Gecode 7 series, and the branch that originally held all of them. What remains here is the clang-tidy sweep: 80 commits, each enabling a single check or small group of checks and fixing what it reports, so every commit passes
misc/check.py lint.Most of the commits are small and mechanical: removing
(void)parameter lists, switching to nested namespaces, replacingtypedefwithusing, adopting range-based loops,contains(),empty(),starts_with(),make_unique, andmake_shared, dropping redundant casts andelseafterreturn, and matching parameter names between declarations and definitions.A smaller set of commits makes behavioral or API-visible changes and is worth a closer look:
NaryInterandNaryUnionpreviously dropped their free list when assigned to themselves.FlatZinc::Error,AST::TypeError, andShapeErrorfromstd::exceptionwithwhat(), and updates tests that threw rawintto usestd::logic_error._GNU_SOURCEinblackbox-backend.cpp), checks for likely swapped call arguments, checks that rvalue reference parameters are moved, givesBranchPlugina virtual destructor, and drops a default argument from a virtual function.cplusplus,deadcode,nullability,optin,security,unix,valist), removes dead stores (including an unused search timer in Gist), fixes a declaration/definition name mismatch inCutoff::geometric, and documents every remaining suppression in place.parser.hh, making internal parser helpersstaticand isolating thefree()ofstrduptoken strings in one helper.docs/code-style.mdrecords why each excluded clang-tidy check was left off so future reviews do not have to re-investigate them, and notes that new scoped enums may usePascalCaseenumerators (as inEndReason::Limit).Three late commits fix issues that CI caught on the earlier combined branch: a stray blank line in the unary test, two MSVC build failures (renaming
Pack::calc_dff_lower_bound's template parameterlso MSVC does not resolve it to the data memberl, and definingNOMINMAXinblackbox-exec.cppafter dropping parentheses aroundnumeric_limits), and re-qualifying a matrix slice conversion for MSVC. I left them as separate commits rather than folding them back into the sweep commits they fix.The final two commits record the
.zdevdevelopment notes for the Gecode 7 work and then remove them so they are not merged intomain.Tested at the tip on macOS: the build produces no warnings; formatting, generated-source freshness, and
misc/check.py lintall pass; andcheckpasses 569 of 569.Stack
Merge in this order. #242 targets
main, and each later PR builds on the one before it so its diff shows only its own commits. The first four PRs are standalone search and random-number changes; #284 through #274 are the Gecode 7 changes split out of what used to be a single branch.