summaryrefslogtreecommitdiffhomepage
path: root/CONTRIBUTING.md
blob: d754f73325b9d753a73862e835cff7331855e2ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Contributing to whoson

Small tool, small rules.

## Building

whoson is a single C23 file with no external library, so it builds on z/OS
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
```

Needs IBM Open XL C/C++ 2.2 (`ibm-clang`, pinned by absolute path in the
`Makefile`) and z/OS 2.5 or later, the oldest target that compiler accepts.

`buildenv` is the zopen port. From a checkout or a release tree:

```sh
zopen build             # stable: the release tarball
zopen build -b DEV      # the git tree on main
```

It builds with the compiler zopen detects, runs `make check`, and installs
`whoson` under `$ZOPEN_INSTALL_DIR`; on a system where `/usr/local/zopen` is
read-only, `export ZOPEN_INSTALL_DIR=~/.local/zopen` first. Bump
`WHOSON_VERSION` there with `VERSION`
in the `Makefile`; CI checks they agree.

GNU make and IBM's make both have to parse the Makefile: keep it to POSIX make
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 -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.
- `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. Functions, types and
  globals carry a Doxygen `@brief`; struct members carry `/**< */`.

## Changes

- One PR per change, branched from `main`, merged through the PR.
- Touching how a control block or a `ps` row is parsed means saying which field
  was wrong and what the probe or `ps` showed. Do not adjust an example to make
  a claim true.
- No binaries in the tree, and nothing generated (`.clangd` indexes,
  `whoson.json`) gets committed.

## Releasing

1. Bump `VERSION` in the `Makefile`, `WHOSON_VERSION` in `buildenv`, and add
   the entry to `CHANGELOG.md`.
2. Merge, then tag `main` with `v<version>` and push the tag.
3. `.github/workflows/release.yml` refuses a tag that disagrees with
   `VERSION`, takes the release notes from that `CHANGELOG.md` section, and
   attaches the source archive with its sha256. `buildenv` fetches that same
   archive for the zopen stable build.

There is no binary in a release: whoson only builds on z/OS, so a release
ships the sources and the build instructions.