Add bits/stdc++.h replacement helper and support generator.sh #4

Open
haire wants to merge 1 commit from haire/fix_check_problems into main AGit
Member

check_problem.sh now accepts generator.sh (nicer than generator, since editors highlight .sh), and the bits/stdc++.h failure now points at a new helper, scripts/bits-replacer.py, that rewrites the include into the minimal real headers. CI policy is unchanged: bits/stdc++.h still fails the check.

Also fixes the source-file scan to include .cxx/.c++/.h++, which were silently skipped before.

The helper is a manual, opt-in tool, not run at compile time or by CI, vendored from hairez/bits-replacer.

`check_problem.sh` now accepts `generator.sh` (nicer than generator, since editors highlight `.sh`), and the `bits/stdc++.h` failure now points at a new helper, `scripts/bits-replacer.py`, that rewrites the include into the minimal real headers. CI policy is unchanged: `bits/stdc++.h` still fails the check. Also fixes the source-file scan to include `.cxx/.c++/.h++`, which were silently skipped before. The helper is a manual, opt-in tool, not run at compile time or by CI, vendored from `hairez/bits-replacer`.
Add bits-replacer tool and fix check_problem.sh
Some checks are pending
CI / Code Quality (pull_request) Blocked by required conditions
CI / Get Problem Changes (pull_request) Blocked by required conditions
CI / Python (pull_request) Blocked by required conditions
CI / Shell Scripts (pull_request) Blocked by required conditions
CI / Get changed problems (pull_request) Blocked by required conditions
0541821c41
@ -4,3 +4,3 @@
output-format = "grouped"
target-version = "py310"
extend-exclude = ["./testdata_tools/", "problems/*/submissions/*/deepseek_*.py", "problems/*/submissions/*/openai_*.py"]
extend-exclude = ["./testdata_tools/", "./scripts/bits-replacer.py", "problems/*/submissions/*/deepseek_*.py", "problems/*/submissions/*/openai_*.py"]
Owner

Why is the script added as an exception?

Why is the script added as an exception?
@ -0,0 +158,4 @@
# A stable, roughly canonical ordering for emitted includes (C then C++ containers
# then algorithms then I/O), falling back to alphabetical for anything unlisted.
ORDER = [
Owner

Why not just alphabetical over all?

Why not just alphabetical over all?
Author
Member

That is simpler. Committed upstream in github.com/hairez/bits-replacer@d677428aed

That is simpler. Committed upstream in https://github.com/hairez/bits-replacer/commit/d677428aed527972a23e58455f099c637a5c8915
@ -32,0 +33,4 @@
if [ -x generator.sh ]; then
gen=(./generator.sh)
elif [ -f generator.sh ]; then
gen=(bash generator.sh)
Owner

Generator should be executable, this should be an error in my opinion

Generator should be executable, this should be an error in my opinion
@ -32,0 +35,4 @@
elif [ -f generator.sh ]; then
gen=(bash generator.sh)
else
gen=(./generator)
Owner

I think it's fair to emit a warning here as having the extension is nicer.

I think it's fair to emit a warning here as having the extension is nicer.
Some checks are pending
CI / Code Quality (pull_request) Blocked by required conditions
CI / Get Problem Changes (pull_request) Blocked by required conditions
CI / Python (pull_request) Blocked by required conditions
CI / Shell Scripts (pull_request) Blocked by required conditions
CI / Get changed problems (pull_request) Blocked by required conditions
This pull request can be merged automatically.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin +refs/pull/4/head:haire/fix_check_problems
git switch haire/fix_check_problems

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff haire/fix_check_problems
git switch haire/fix_check_problems
git rebase main
git switch main
git merge --ff-only haire/fix_check_problems
git switch haire/fix_check_problems
git rebase main
git switch main
git merge --no-ff haire/fix_check_problems
git switch main
git merge --squash haire/fix_check_problems
git switch main
git merge --ff-only haire/fix_check_problems
git switch main
git merge haire/fix_check_problems
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
KFFI/contest_template!4
No description provided.