diff options
| author | Samuel Lidén Borell <samuel@kodafritt.se> | 2025-12-07 12:42:36 +0100 |
|---|---|---|
| committer | Samuel Lidén Borell <samuel@kodafritt.se> | 2025-12-07 12:48:09 +0100 |
| commit | c633905a08680b6d8b21a43b2a4a631604a60de9 (patch) | |
| tree | 343c875d3b981a03dedfe724b90a47b5ebad3168 /bootstrap/Makefile | |
| parent | 2d70f9750257fb2012ec93c4c998ca36c8846021 (diff) | |
| download | slul-try2-main.tar.gz slul-try2-main.zip | |
Using keywords as macro arguments appears to be non-portable. It fails
in MesCC, and using true/false as macro arguments fails in Turbo C 2.01.
Given that it fails in two C compilers, it might fail in others as well.
It also breaks source highlighting and search for references of T_KW_*
enum values.
This commits replaces the 2-argument CMP_KW macro with a 3-argument one
with keyword fully spelled out as a string and enum.
Diffstat (limited to 'bootstrap/Makefile')
| -rw-r--r-- | bootstrap/Makefile | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bootstrap/Makefile b/bootstrap/Makefile index 2e8bb8e..6c9a77c 100644 --- a/bootstrap/Makefile +++ b/bootstrap/Makefile @@ -150,7 +150,8 @@ $(builddir)/stage2: $(STAGE2_OBJECTS) $(RTL_C_HEADERS) longlines outdirs # TODO add a proper test once the stage2 compiler is done check: $(builddir)/stage2 -check-all: check check-valgrind check-boundschecked clang-analyze longlines +check-all: check check-valgrind check-boundschecked clang-analyze \ + check-tokens longlines check-valgrind: $(builddir)/stage1 valgrind --leak-check=yes -q $(builddir)/stage1 $(STAGE1_ARGS) check-boundschecked: $(builddir)/stage1-boundschecked @@ -165,6 +166,16 @@ longlines: else \ true ;\ fi +check-tokens: + grep -E '^ +CMP_KW' $(srcdir)/token.c | \ + sed -E -e 's/^.*, "([^"]+)", T_KW_([a-zA-Z0-9_]+)\)/\1 \2/' | \ + while read kwstr kwconst; do \ + if [ "x$$kwstr" != "x$$kwconst" ]; then \ + printf "Keyword str \"%s\" and enum \"%s\" mismatch\n" \ + "$$kwstr" "$$kwconst" >&2; \ + exit 1; \ + fi; \ + done # Gives a lot of warnings (possibly false positives) and output gets mixed # up (unless a single file is processed). So not included in check-all. gcc-analyzer: |
