Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9dcbe96
Implement Python checks
eisenwave Jun 17, 2026
6d4a54c
Upgrade pyright to Python 3.12
eisenwave Jul 25, 2026
9f2e23e
Modernize type annotations
eisenwave Jul 25, 2026
017ddec
Put lookup tables into separate file
eisenwave Jul 25, 2026
fe02c01
Add new commands
eisenwave Jul 25, 2026
c0c5e23
Disable library checks in UB/IFNDR annexes
eisenwave Jul 25, 2026
1e73cea
Remove unnecessary pass
eisenwave Jul 25, 2026
270d416
Simplify if statement to max
eisenwave Jul 25, 2026
8daba1d
Remove unnecessary trailing comments
eisenwave Jul 25, 2026
1a5fc29
Simplify exit code computation
eisenwave Jul 25, 2026
35ed7e7
Move space into preceding string
eisenwave Jul 25, 2026
e20070e
Fix typos for base-tcode-exposid expectations
eisenwave Jul 25, 2026
4513a75
Ignore common Python files
eisenwave Jul 25, 2026
5111413
Clean code around col1 and col2
eisenwave Jul 25, 2026
665dbe0
Remove unnecessary begin_pattern and end_pattern variables
eisenwave Jul 25, 2026
7cbded1
Fix Ruff default warnings
eisenwave Jul 25, 2026
c48c2dd
Rename id->uid, manage properly in derived classes
eisenwave Jul 25, 2026
388e42c
Convert find_env_ranges to coroutine
eisenwave Jul 25, 2026
7af3d56
Eliminate global state
eisenwave Jul 25, 2026
33b9379
Simplify read_file
eisenwave Jul 25, 2026
147575e
Eliminate uses for os.path.relpath
eisenwave Jul 25, 2026
0cebc60
Clean up NOCHECK directive handling in run_checks
eisenwave Jul 25, 2026
7a03870
Drop ABC
eisenwave Jul 25, 2026
9460b52
Add walkUp=True argument to allow running from source/
eisenwave Jul 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/check-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: check-python

on:
pull_request:
paths:
- "tools/**.py"
- "pyrightconfig.json"
- ".github/workflows/check-python.yml"
push:
paths:
- "tools/**.py"
- "pyrightconfig.json"
- ".github/workflows/check-python.yml"

jobs:
pyright:
name: Pyright type check
runs-on: ubuntu-24.04

steps:
- name: checkout
uses: actions/checkout@v6

- name: setup Node
uses: actions/setup-node@v6
with:
node-version: "20"

- name: install pyright
run: npm install -g pyright

- name: run pyright
run: pyright
3 changes: 3 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: check-source.sh
run: ../tools/check-source.sh

- name: check-source.py
run: python3 ../tools/check-source.py

- name: update brew
if: matrix.cfg.os == 'macos-15'
run: brew update
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ tools/sections
*.synctex.gz
*.synctex*
.check.stamp

__pycache__
*.pyc
*.egg
*.egg-info
14 changes: 14 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"include": [
"tools/*.py"
],
"typeCheckingMode": "strict",
"reportMissingTypeStubs": false,
"reportUnknownMemberType": false,
"reportUnknownArgumentType": false,
"reportUnknownVariableType": false,
"reportUnknownParameterType": false,
"reportUnusedImport": true,
"reportUnusedVariable": true,
"pythonVersion": "3.12"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason why this requires Python 3.12 rather than the current version (3.14)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current GitHub actions ubuntu-latest runner is on Ubuntu 24.04 according to GitHub's documentation, whose Python3 package is 3.12.3.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not a limitation. You might as well pull a newer Python version in through uv or something like micromamba. Also there's an official Python docker container.

3.12 is probably okay for now, but let's please switch to something newer the second we want to use a Python 3.13 or later feature.

}
1 change: 1 addition & 0 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[algorithms]{Algorithms library}

\rSec1[algorithms.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/assets/example_01.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN
\documentclass[9pt]{standalone}

\usepackage{fontspec}
Expand Down
1 change: 1 addition & 0 deletions source/assets/example_02.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN
\documentclass[9pt]{standalone}

\usepackage{fontspec}
Expand Down
1 change: 1 addition & 0 deletions source/assets/example_03.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN
\documentclass[9pt]{standalone}

\usepackage{fontspec}
Expand Down
1 change: 1 addition & 0 deletions source/assets/example_04.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN
\documentclass[9pt]{standalone}

\usepackage{fontspec}
Expand Down
1 change: 1 addition & 0 deletions source/assets/example_05.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN
\documentclass[9pt]{standalone}

\usepackage{fontspec}
Expand Down
1 change: 1 addition & 0 deletions source/assets/example_06.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN
\documentclass[9pt]{standalone}

\usepackage{fontspec}
Expand Down
1 change: 1 addition & 0 deletions source/basic.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[basic]{Basics}

\gramSec[gram.basic]{Basics}
Expand Down
1 change: 1 addition & 0 deletions source/classes.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[class]{Classes}%
\indextext{class|(}

Expand Down
1 change: 1 addition & 0 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\infannex{diff}{Compatibility}

\rSec1[diff.cpp26]{\Cpp{} and ISO \CppXXVI{}}
Expand Down
1 change: 1 addition & 0 deletions source/concepts.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[concepts]{Concepts library}

\rSec1[concepts.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/containers.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[containers]{Containers library}

\rSec1[containers.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/declarations.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[dcl]{Declarations}%
\indextext{declaration|(}

Expand Down
1 change: 1 addition & 0 deletions source/diagnostics.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[diagnostics]{Diagnostics library}

\rSec1[diagnostics.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/exceptions.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[except]{Exception handling}%
\indextext{exception handling|(}

Expand Down
1 change: 1 addition & 0 deletions source/exec.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[exec]{Execution control library}

\rSec1[exec.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/expressions.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[expr]{Expressions}

\gramSec[gram.expr]{Expressions}
Expand Down
1 change: 1 addition & 0 deletions source/future.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\normannex{depr}{Compatibility features}

\rSec1[depr.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/grammar.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%NOCHECKBEGIN(lib-*)
\infannex{gram}{Grammar summary}

\rSec1[gram.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/ifndr.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\infannex{ifndr}{Ill-formed, no diagnostic required}

\rSec1[ifndr.general]{General}
Expand Down
4 changes: 2 additions & 2 deletions source/intro.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)

\clearpage
\bigskip\noindent\textlarger{\textbf{Programming languages --- \Cpp{}}}
Expand Down Expand Up @@ -325,8 +326,7 @@
behavior, for a \termref{defns.well.formed}{well-formed program}{} construct and correct data, that
depends on the implementation and that each implementation documents

\definition{implementation-defined strict total order over pointers}
{defns.order.ptr}
\definition{implementation-defined strict total order over pointers}{defns.order.ptr}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like an unrelated change, does it have to be in this patch?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, it's like this because the definition-checking check uses capture groups to yoink the defns.order.ptr out of this command, and this regex is applied line-by-line. The checks would fail if this wasn't put onto one line.

It's easier to change just this one place in the standard markup than to redesign the checks and make them cross-line.

@Tsche Tsche Aug 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but why in this patch? This seems like an okay change to do separately.

I'd prefer if this patch doesn't touch anything that isn't directly related to the new script.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the Python checks also come with CI checks in this PR that actually run them, and you don't get a green build if you don't change this line of markup.

@Tsche Tsche Aug 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That I understand, but why does this need to be in this patch? Why can't that be done separately?

\indexdefn{pointer!strict total order}%
\defncontext{library}
\impldef{strict total order over pointer values}
Expand Down
1 change: 1 addition & 0 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[input.output]{Input/output library}

\rSec1[input.output.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/iterators.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[iterators]{Iterators library}

\rSec1[iterators.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/layout.tex
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
% Register our intent to number the next paragraph. Don't actually number it
% yet, because we might have a paragraph break before we see its contents (for
% example, if the paragraph begins with a note or example).
%EXPECTCHECKNEXTLINE(base-pnum-alone)
\def\pnum{%
\global\def\maybeaddpnum{\global\def\maybeaddpnum{}\parabullnum{Paras}{0pt}}%
\everypar=\expandafter{\the\everypar\maybeaddpnum}%
Expand Down
1 change: 1 addition & 0 deletions source/lex.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[lex]{Lexical conventions}

\gramSec[gram.lex]{Lexical conventions}
Expand Down
1 change: 1 addition & 0 deletions source/limits.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\infannex{implimits}{Implementation quantities}

\pnum
Expand Down
2 changes: 2 additions & 0 deletions source/macros.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
%!TEX root = std.tex
%NOCHECKBEGIN
%NOCHECKEND(text-*)

% Definitions and redefinitions of special commands
%
Expand Down
1 change: 1 addition & 0 deletions source/memory.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[mem]{Memory management library}

\rSec1[mem.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/meta.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[meta]{Metaprogramming library}

\rSec1[meta.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/modules.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[module]{Modules}%

\gramSec[gram.module]{Modules}
Expand Down
1 change: 1 addition & 0 deletions source/numerics.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[numerics]{Numerics library}

\rSec1[numerics.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/overloading.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[over]{Overloading}%
\indextext{overloading|(}

Expand Down
1 change: 1 addition & 0 deletions source/preprocessor.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[cpp]{Preprocessing directives}%
\indextext{preprocessing directive|(}

Expand Down
1 change: 1 addition & 0 deletions source/statements.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[stmt]{Statements}%
\indextext{statement|(}

Expand Down
1 change: 1 addition & 0 deletions source/strings.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[strings]{Strings library}

\rSec1[strings.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/tables.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%!TEX root = std.tex
% Definitions of table environments
%NOCHECKBEGIN(base-env-balancing)

%%--------------------------------------------------
%% Table environments
Expand Down
1 change: 1 addition & 0 deletions source/templates.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\rSec0[temp]{Templates}%
\indextext{template|(}

Expand Down
1 change: 1 addition & 0 deletions source/text.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)

\rSec0[text]{Text processing library}

Expand Down
1 change: 1 addition & 0 deletions source/threads.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[thread]{Concurrency support library}

\rSec1[thread.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/time.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)
\rSec0[time]{Time library}

\rSec1[time.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/uax31.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\infannex{uaxid}{Conformance with \UAX{31}}

\rSec1[uaxid.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/ub.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-*)
\infannex{ub}{Core undefined behavior}

\rSec1[ub.general]{General}
Expand Down
1 change: 1 addition & 0 deletions source/utilities.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%!TEX root = std.tex
%NOCHECKBEGIN(lib-ranges-*)

\rSec0[utilities]{General utilities library}

Expand Down
Loading
Loading