summaryrefslogtreecommitdiffhomepage
path: root/src/exec.c
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 12:52:38 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 12:52:38 -0600
commite569552eb9766bc663871b6f3cb203a77e83503c (patch)
treea3bd6f994a6c61aae2430e51de762880b002be03 /src/exec.c
parent5d830cb1c04da59553d3af848340162a7be9fa58 (diff)
downloadzash-e569552eb9766bc663871b6f3cb203a77e83503c.tar.gz
C23: constexpr internal linkage, naming and trailing commas; clangd at C23
A constexpr at file scope has external linkage, so the CSI offsets and CSI_MAX_CALLS now say static. The naming check gets the C23 spellings wrap the check itself: typed constants keep the macro case, and a local static constexpr table keeps the variable case. .clangd says -std=c23, which it still did not, so the editor could not read constexpr at all.
Diffstat (limited to 'src/exec.c')
-rw-r--r--src/exec.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/exec.c b/src/exec.c
index fbc46ba..c0267a8 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -215,10 +215,14 @@ static int eval_time(const node *n, unsigned flags) {
getrusage(RUSAGE_SELF, &s1);
getrusage(RUSAGE_CHILDREN, &c1);
bool posix = n->u.time.posix;
- long long self[2] = {tv_diff(s0.ru_utime, s1.ru_utime),
- tv_diff(s0.ru_stime, s1.ru_stime)};
- long long kids[2] = {tv_diff(c0.ru_utime, c1.ru_utime),
- tv_diff(c0.ru_stime, c1.ru_stime)};
+ long long self[2] = {
+ tv_diff(s0.ru_utime, s1.ru_utime),
+ tv_diff(s0.ru_stime, s1.ru_stime),
+ };
+ long long kids[2] = {
+ tv_diff(c0.ru_utime, c1.ru_utime),
+ tv_diff(c0.ru_stime, c1.ru_stime),
+ };
static const char *const label[2] = {"user", "sys"};
out_flush(&out1);
put_time("real", tv_diff(t0, t1), posix);
@@ -877,7 +881,10 @@ static void assign_temp(const simple_cmd *sc) {
*/
static bool tag_prefix_begin(const simple_cmd *sc, tag_mode saved[3]) {
static const char *const name[3] = {
- "_TAG_REDIR_IN=", "_TAG_REDIR_OUT=", "_TAG_REDIR_ERR="};
+ "_TAG_REDIR_IN=",
+ "_TAG_REDIR_OUT=",
+ "_TAG_REDIR_ERR=",
+ };
bool any = false;
memcpy(saved, tag_redir, sizeof tag_redir);
for (int i = 0; i < sc->nassign; i++) {