diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-28 18:57:06 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-28 18:57:06 -0600 |
| commit | 7ecdc5efc90cd0f983764997fb17da6928b908fa (patch) | |
| tree | 582a776ea6445a69aa2a9524244e567a86a60c6a /CONTRIBUTING.md | |
| parent | 0922e0b31b3a476c250d8677fb76fdf2d542723e (diff) | |
| download | whoson-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 'CONTRIBUTING.md')
| -rw-r--r-- | CONTRIBUTING.md | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 35934f8..d754f73 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,6 +10,8 @@ and nowhere else: ```sh make # -> ./whoson make check # under the CEE heap checker and storage report +make format # clang-format -i whoson.c +make tidy # clang-tidy, which needs the z/OS headers make install # -> ~/.local/bin/whoson ``` @@ -34,17 +36,28 @@ syntax (`?=` is out), and let `make -n` stay free of side effects. ## Style +`C-PROGRAMMING-STANDARDS.md` is the authority for language level, types, +comments and the Makefile targets; this list is only what a change here has to +remember. + - Warnings are bugs. The tree builds with `-Wall -Wextra -Wpedantic -Wshadow - -Wconversion`; a warning from any of them, or from `clang-tidy` with - `.clang-tidy`, gets fixed rather than silenced. `.clang-tidy` needs the z/OS - headers (`<sys/ps.h>`), so only a z/OS build environment can run it; the - Ubuntu CI job enforces clang-format, not clang-tidy. + -Wconversion -Wstrict-prototypes -Wmissing-prototypes`; a warning from any + of them, or from `clang-tidy` with `.clang-tidy`, gets fixed rather than + silenced. `.clang-tidy` needs the z/OS headers (`<sys/ps.h>`), so only a z/OS + build environment can run it, and IBM Open XL ships no clang-tidy: the only + one on the host is zopen's LLVM, which cannot compile z/OS `va_list` + (`__builtin_zos_va_start`). `make tidy` therefore reports those compiler + errors and nothing else; the Ubuntu CI job enforces clang-format. +- C23: `nullptr` rather than `NULL`, `static_assert`, and `constexpr` for the + buffer and column widths. Compiler-only attributes go through a macro + (`PRINTFLIKE`). - Types are `typedef struct name { ... } name;`, and no variable, function or field reuses a type name. -- `clang-format -i whoson.c` before committing; `.clang-format` is the - authority, and CI checks the result against clang-format 23.1.5. +- `make format` before committing; `.clang-format` is the authority, and CI + checks the result against clang-format 23.1.5. - Comments say why, not what, and the file header says what the control-block - walk and the process table give and what they do not. + walk and the process table give and what they do not. Functions, types and + globals carry a Doxygen `@brief`; struct members carry `/**< */`. ## Changes |
