summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-28 18:57:06 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-28 18:57:06 -0600
commit7ecdc5efc90cd0f983764997fb17da6928b908fa (patch)
tree582a776ea6445a69aa2a9524244e567a86a60c6a /Makefile
parent0922e0b31b3a476c250d8677fb76fdf2d542723e (diff)
downloadwhoson-fix/c-programming-standards.tar.gz
Follow C-PROGRAMMING-STANDARDS.md throughoutfix/c-programming-standards
The standards document that merged as PR #25 is now the reference for the language level, the diagnostics, the names and the comments. What the audit found and this commit settles: - C23 in full: nullptr instead of NULL, static_assert for every offset the walk reads, constexpr for the buffer and column widths, and the one compiler attribute wrapped in PRINTFLIKE so call sites stay C23. - -Wstrict-prototypes and -Wmissing-prototypes, which the document requires and the Makefile did not carry. - Lower-case constexpr names, and static so each stays internal. - A Doxygen block on every function, type, global and macro, and /**< */ on every member, as section 3.3 asks. - -D_OPEN_SYS_FILE_EXT=1, the value the document names, in the Makefile and in .clangd. - make format and make tidy, the two target names the document gives. - The eye-catcher hex, the CHTRKID value and the EBCDIC reasoning now carry the why in a comment rather than standing bare. Where the document and this program disagree, the program keeps its reason and CONTRIBUTING.md records the agreement where it is not obvious. Also fixes the wall of undecodable bytes after `make check`: the runtime's own storage report, and the one the ps child inherits, are EBCDIC text written to an ASCII log. An untagged stdout or stderr is now tagged ISO8859-1 before anything writes to it, so both reports arrive as text.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ffa5f04..491938d 100644
--- a/Makefile
+++ b/Makefile
@@ -38,13 +38,14 @@ VERSION = 1.1.0
CCDIR = /usr/lpp/IBM/cnw/v2r2/openxl/bin
CC = $(CCDIR)/ibm-clang
CPPFLAGS = -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L -D_ALL_SOURCE \
- -D_EXT -D_OPEN_SYS -D_OPEN_SYS_FILE_EXT \
+ -D_EXT -D_OPEN_SYS -D_OPEN_SYS_FILE_EXT=1 \
-DWHOSON_VERSION=\"$(VERSION)\"
CFLAGS = -std=c23 -O3 -m64 -mzos-target=zosv2r5 -fzos-le-char-mode=ascii \
- -Wall -Wextra -Wpedantic -Wshadow -Wconversion
+ -Wall -Wextra -Wpedantic -Wshadow -Wconversion \
+ -Wstrict-prototypes -Wmissing-prototypes
CEEOPTS = HEAPCHK(ON,1,32),RPTSTG(ON),FILETAG(AUTOCVT,AUTOTAG),POSIX(ON)
-.PHONY: all install check list clean
+.PHONY: all install check list format tidy clean
all: whoson
@@ -66,6 +67,14 @@ install: whoson
cp whoson $(BINDIR)/whoson
chmod 755 $(BINDIR)/whoson
+# The two gates that run off-platform, named as the standards document asks.
+# tidy needs the z/OS headers, so it only runs on z/OS.
+format:
+ clang-format -i whoson.c
+
+tidy:
+ clang-tidy whoson.c -- $(CPPFLAGS) -std=c23
+
check: whoson
_CEE_RUNOPTS="$(CEEOPTS)" ./whoson