Fix format errors in printf-like functions
This commit is contained in:
		
							parent
							
								
									d03fe10be8
								
							
						
					
					
						commit
						129020e1c5
					
				| @ -56,7 +56,7 @@ vaerr(const char *prefix, const char *func, const char *errstr, va_list ap) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void __attribute__((format(printf, 3, 4))) | ||||
| void | ||||
| verr(const char *prefix, const char *func, const char *errstr, ...) | ||||
| { | ||||
| 	va_list ap; | ||||
| @ -65,7 +65,7 @@ verr(const char *prefix, const char *func, const char *errstr, ...) | ||||
| 	va_end(ap); | ||||
| } | ||||
| 
 | ||||
| void __attribute__((format(printf, 3, 4))) | ||||
| void | ||||
| vdie(const char *prefix, const char *func, const char *errstr, ...) | ||||
| { | ||||
| 	va_list ap; | ||||
|  | ||||
| @ -19,8 +19,8 @@ int mkpath(const char *path, mode_t mode, int is_dir); | ||||
| void progname_set(char *name); | ||||
| const char *progname_get(void); | ||||
| void enable_debug(void); | ||||
| void verr(const char *prefix, const char *func, const char *errstr, ...); | ||||
| void vdie(const char *prefix, const char *func, const char *errstr, ...); | ||||
| void verr(const char *prefix, const char *func, const char *errstr, ...) __attribute__((format(printf, 3, 4))); | ||||
| void vdie(const char *prefix, const char *func, const char *errstr, ...) __attribute__((format(printf, 3, 4))); | ||||
| 
 | ||||
| /* clang-format off */ | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "bay.h" | ||||
| @ -168,7 +168,7 @@ propagate_chan(struct bay_chan *bchan, enum bay_cb_type type) | ||||
| 	struct bay_cb *cur = NULL; | ||||
| 	/* New callbacks cannot be added while propagating a bay_chan */ | ||||
| 	DL_FOREACH(bchan->cb[type], cur) { | ||||
| 		dbg("calling cb %p", cur->func); | ||||
| 		dbg("calling cb %"PRIxPTR, (uintptr_t) cur->func); | ||||
| 		if (cur->func(bchan->chan, cur->arg) != 0) { | ||||
| 			err("callback failed for %s", bchan->chan->name); | ||||
| 			return -1; | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "body.h" | ||||
| @ -135,7 +135,7 @@ body_execute(struct body_stack *stack, struct body *body) | ||||
| 
 | ||||
| 	DL_PREPEND(stack->top, body); | ||||
| 
 | ||||
| 	dbg("%s state is now Running, iteration %lld", | ||||
| 	dbg("%s state is now Running, iteration %ld", | ||||
| 			body->name, body->iteration); | ||||
| 
 | ||||
| 	return 0; | ||||
| @ -258,7 +258,7 @@ body_end(struct body_stack *stack, struct body *body) | ||||
| 	DL_DELETE(stack->top, body); | ||||
| 	body->stack = NULL; | ||||
| 
 | ||||
| 	dbg("%s state is now Dead, completed iteration %lld", | ||||
| 	dbg("%s state is now Dead, completed iteration %ld", | ||||
| 			body->name, body->iteration); | ||||
| 
 | ||||
| 	return 0; | ||||
|  | ||||
| @ -7,7 +7,7 @@ | ||||
| #include <string.h> | ||||
| #include "common.h" | ||||
| 
 | ||||
| void __attribute__((format(printf, 3, 4))) | ||||
| void | ||||
| chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...) | ||||
| { | ||||
| 	memset(chan, 0, sizeof(struct chan)); | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #ifndef CHAN_H | ||||
| @ -70,7 +70,7 @@ chan_read(struct chan *chan, struct value *value) | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
|         void chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...); | ||||
|         void chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...) __attribute__((format(printf, 3, 4))); | ||||
| USE_RET int chan_set(struct chan *chan, struct value value); | ||||
| USE_RET int chan_push(struct chan *chan, struct value value); | ||||
| USE_RET int chan_pop(struct chan *chan, struct value expected); | ||||
|  | ||||
| @ -220,7 +220,7 @@ cpu_update(struct cpu *cpu) | ||||
| 
 | ||||
| 	/* Only virtual cpus can be oversubscribed */ | ||||
| 	if (cpu->nth_running > 1 && !cpu->is_virtual) { | ||||
| 		err("physical cpu %s has %d threads running at the same time", | ||||
| 		err("physical cpu %s has %zd threads running at the same time", | ||||
| 				cpu->name, cpu->nth_running); | ||||
| 		return -1; | ||||
| 	} | ||||
| @ -248,7 +248,7 @@ cpu_update(struct cpu *cpu) | ||||
| 		err("chan_set pid failed"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	dbg("cpu%lld sets th_running to %s", | ||||
| 	dbg("cpu%"PRIi64" sets th_running to %s", | ||||
| 			cpu->gindex, value_str(gid_running)); | ||||
| 	if (chan_set(&cpu->chan[CPU_CHAN_THRUN], gid_running) != 0) { | ||||
| 		err("chan_set gid_running failed"); | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "emu.h" | ||||
| @ -118,9 +118,9 @@ panic(struct emu *emu) | ||||
| 	if (emu->ev != NULL) { | ||||
| 		err("event: "); | ||||
| 		err("  mcv=%s", emu->ev->mcv); | ||||
| 		err("  rclock=%lld", emu->ev->rclock); | ||||
| 		err("  sclock=%lld", emu->ev->sclock); | ||||
| 		err("  dclock=%lld", emu->ev->dclock); | ||||
| 		err("  rclock=%"PRIi64, emu->ev->rclock); | ||||
| 		err("  sclock=%"PRIi64, emu->ev->sclock); | ||||
| 		err("  dclock=%"PRIi64, emu->ev->dclock); | ||||
| 		err("  payload_size=%zd", emu->ev->payload_size); | ||||
| 		err("  is_jumbo=%d", emu->ev->is_jumbo); | ||||
| 	} | ||||
| @ -128,8 +128,8 @@ panic(struct emu *emu) | ||||
| 	if (emu->stream != NULL) { | ||||
| 		err("stream: "); | ||||
| 		err("  relpath=%s", emu->stream->relpath); | ||||
| 		err("  offset=%lld", emu->stream->offset); | ||||
| 		err("  clock_offset=%lld", emu->stream->clock_offset); | ||||
| 		err("  offset=%"PRIi64, emu->stream->offset); | ||||
| 		err("  clock_offset=%"PRIi64, emu->stream->clock_offset); | ||||
| 	} | ||||
| 	err("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); | ||||
| } | ||||
| @ -156,7 +156,7 @@ emu_step(struct emu *emu) | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	dbg("----- mvc=%s dclock=%lld -----", emu->ev->mcv, emu->ev->dclock); | ||||
| 	dbg("----- mcv=%s dclock=%"PRIi64" -----", emu->ev->mcv, emu->ev->dclock); | ||||
| 
 | ||||
| 	emu_stat_update(&emu->stat, &emu->player); | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "emu_stat.h" | ||||
| @ -54,11 +54,9 @@ emu_stat_report(struct emu_stat *stat, struct player *player, int last) | ||||
| 	double speed = stat->average ? avgspeed : instspeed; | ||||
| 
 | ||||
| 	if (last) { | ||||
| 		int tmin = (int) (time_elapsed / 60.0); | ||||
| 		int tsec = (int) ((time_elapsed / 60.0 - tmin) * 60.0); | ||||
| 		info("%5.1f%% done at avg %.0f kev/s                  \n", | ||||
| 				progress * 100.0, avgspeed * 1e-3, tmin, tsec); | ||||
| 		info("processed %lld input events in %.2f s\n", | ||||
| 				progress * 100.0, avgspeed * 1e-3); | ||||
| 		info("processed %"PRIi64" input events in %.2f s\n", | ||||
| 				nprocessed, time_elapsed); | ||||
| 	} else { | ||||
| 		int tmin = (int) (time_left / 60.0); | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #ifndef LOOM_H | ||||
| @ -14,7 +14,7 @@ | ||||
| struct proc; | ||||
| 
 | ||||
| struct loom { | ||||
| 	size_t gindex; | ||||
| 	int64_t gindex; | ||||
| 	int is_init; | ||||
| 
 | ||||
| 	char name[PATH_MAX]; | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "model_cpu.h" | ||||
| @ -40,7 +40,8 @@ init_chan(struct model_cpu *cpu, const struct model_chan_spec *spec, int64_t gin | ||||
| 		const char *ch_name = spec->ch_names[i]; | ||||
| 		int track_mode = spec->track[i]; | ||||
| 
 | ||||
| 		if (track_init(track, cpu->bay, TRACK_TYPE_TH, track_mode, "%s.cpu%lld.%s", | ||||
| 		if (track_init(track, cpu->bay, TRACK_TYPE_TH, track_mode, | ||||
| 					"%s.cpu%"PRIi64".%s", | ||||
| 					name, gindex, ch_name) != 0) { | ||||
| 			err("track_init failed"); | ||||
| 			return -1; | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "mux.h" | ||||
| @ -25,7 +25,7 @@ default_select(struct mux *mux, | ||||
| 	int64_t index = key.i; | ||||
| 
 | ||||
| 	if (index < 0 || index >= mux->ninputs) { | ||||
| 		err("index out of bounds %lld", index); | ||||
| 		err("index out of bounds %"PRIi64, index); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| @ -214,7 +214,7 @@ mux_set_input(struct mux *mux, int64_t index, struct chan *chan) | ||||
| 	struct mux_input *input = &mux->inputs[index]; | ||||
| 
 | ||||
| 	if (input->chan != NULL) { | ||||
| 		err("input %d already has a channel", index); | ||||
| 		err("input %"PRIi64" already has a channel", index); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -32,8 +32,8 @@ static int | ||||
| create_cpu(struct bay *bay, struct breakdown_cpu *bcpu, int64_t gindex) | ||||
| { | ||||
| 	enum chan_type t = CHAN_SINGLE; | ||||
| 	chan_init(&bcpu->tr,  t, "nanos6.cpu%lld.breakdown.tr",  gindex); | ||||
| 	chan_init(&bcpu->tri, t, "nanos6.cpu%lld.breakdown.tri", gindex); | ||||
| 	chan_init(&bcpu->tr,  t, "nanos6.cpu%"PRIi64".breakdown.tr",  gindex); | ||||
| 	chan_init(&bcpu->tri, t, "nanos6.cpu%"PRIi64".breakdown.tri", gindex); | ||||
| 
 | ||||
| 	/* Register all channels in the bay */ | ||||
| 	if (bay_register(bay, &bcpu->tr) != 0) { | ||||
| @ -131,7 +131,7 @@ select_tr(struct mux *mux, struct value value, struct mux_input **input) | ||||
| 
 | ||||
| 	int64_t i = in_body; | ||||
| 	char *inputs[] = { "subsystem", "task_type" }; | ||||
| 	dbg("selecting input %lld (%s)", i, inputs[i]); | ||||
| 	dbg("selecting input %"PRIi64" (%s)", i, inputs[i]); | ||||
| 	*input = mux_get_input(mux, i); | ||||
| 
 | ||||
| 	return 0; | ||||
|  | ||||
| @ -396,7 +396,7 @@ finish_pvt(struct emu *emu, const char *name) | ||||
| 		return -1; | ||||
| 	} | ||||
| 	struct pcf *pcf = pvt_get_pcf(pvt); | ||||
| 	long typeid = pvt_type[CH_TYPE]; | ||||
| 	int typeid = pvt_type[CH_TYPE]; | ||||
| 	struct pcf_type *pcftype = pcf_find_type(pcf, typeid); | ||||
| 	if (pcftype == NULL) { | ||||
| 		err("cannot find %s pcf type %d", name, typeid); | ||||
|  | ||||
| @ -229,7 +229,7 @@ pre_affinity_set(struct emu *emu) | ||||
| 	} | ||||
| 
 | ||||
| 	if (emu->ev->payload_size != 4) { | ||||
| 		err("unexpected payload size %d", emu->ev->payload_size); | ||||
| 		err("unexpected payload size %zd", emu->ev->payload_size); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| @ -265,7 +265,7 @@ static int | ||||
| pre_affinity_remote(struct emu *emu) | ||||
| { | ||||
| 	if (emu->ev->payload_size != 8) { | ||||
| 		err("unexpected payload size %d", emu->ev->payload_size); | ||||
| 		err("unexpected payload size %zd", emu->ev->payload_size); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| @ -437,7 +437,7 @@ pre_flush(struct emu *emu) | ||||
| 			double flush_ms = (double) flush_ns * 1e-6; | ||||
| 			/* Avoid last flush warnings */ | ||||
| 			if (flush_ms > 10.0 && emu->thread->is_running) | ||||
| 				warn("large flush of %.1f ms at dclock=%lld ns in tid=%d", | ||||
| 				warn("large flush of %.1f ms at dclock=%"PRIi64" ns in tid=%d", | ||||
| 						flush_ms, | ||||
| 						emu->ev->dclock, | ||||
| 						emu->thread->tid); | ||||
|  | ||||
| @ -87,7 +87,7 @@ print_model(struct model_spec *spec) | ||||
| 	printf("<dl>\n"); | ||||
| 	for (long j = 0; j < spec->evspec->nevents; j++) { | ||||
| 		if (print_event(spec, j) != 0) { | ||||
| 			err("cannot print event %d", j); | ||||
| 			err("cannot print event %ld", j); | ||||
| 			return -1; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| /* This program is a really bad idea. It attempts to sort streams by using a
 | ||||
| @ -106,8 +106,8 @@ find_destination(struct ring *r, uint64_t clock) | ||||
| 		return r->head; | ||||
| 	} | ||||
| 
 | ||||
| 	err("cannot find a event previous to clock %lu", clock); | ||||
| 	err("nback=%zd, last_clock=%lu", nback, last_clock); | ||||
| 	err("cannot find a event previous to clock %"PRIu64, clock); | ||||
| 	err("nback=%zd, last_clock=%"PRIu64, nback, last_clock); | ||||
| 
 | ||||
| 	return -1; | ||||
| } | ||||
| @ -183,7 +183,7 @@ write_events(struct ovni_ev **table, long n, uint8_t *buf) | ||||
| 		memcpy(buf, ev, size); | ||||
| 		buf += size; | ||||
| 
 | ||||
| 		dbg("injected event %c%c%c at %lld", | ||||
| 		dbg("injected event %c%c%c at %"PRIu64, | ||||
| 				ev->header.model, | ||||
| 				ev->header.category, | ||||
| 				ev->header.value, | ||||
| @ -216,7 +216,7 @@ sort_buf(uint8_t *src, uint8_t *buf, int64_t bufsize) | ||||
| { | ||||
| 	struct ovni_ev *ev = (struct ovni_ev *) src; | ||||
| 
 | ||||
| 	dbg("first event before sorting %c%c%c at %lld", | ||||
| 	dbg("first event before sorting %c%c%c at %"PRIu64, | ||||
| 			ev->header.model, | ||||
| 			ev->header.category, | ||||
| 			ev->header.value, | ||||
| @ -238,7 +238,7 @@ sort_buf(uint8_t *src, uint8_t *buf, int64_t bufsize) | ||||
| 	qsort(table, n, sizeof(struct ovni_ev *), cmp_ev); | ||||
| 	write_events(table, n, buf); | ||||
| 
 | ||||
| 	dbg("first event after sorting %c%c%c at %lld", | ||||
| 	dbg("first event after sorting %c%c%c at %"PRIu64, | ||||
| 			ev->header.model, | ||||
| 			ev->header.category, | ||||
| 			ev->header.value, | ||||
| @ -270,19 +270,19 @@ static int | ||||
| execute_sort_plan(struct sortplan *sp) | ||||
| { | ||||
| 	uint64_t clock0 = sp->bad0->header.clock; | ||||
| 	dbg("attempt to sort: start clock %lld", sp->bad0->header.clock); | ||||
| 	dbg("attempt to sort: start clock %"PRIi64, sp->bad0->header.clock); | ||||
| 
 | ||||
| 	uint64_t min_clock = find_min_clock((void *) sp->bad0, (void *) sp->next); | ||||
| 
 | ||||
| 	if (min_clock < clock0) { | ||||
| 		clock0 = min_clock; | ||||
| 		dbg("region not sorted, using min clock=%lld", clock0); | ||||
| 		dbg("region not sorted, using min clock=%"PRIi64, clock0); | ||||
| 	} | ||||
| 
 | ||||
| 	/* Cannot sort in one pass; just fail for now */ | ||||
| 	int64_t i0 = find_destination(sp->r, clock0); | ||||
| 	if (i0 < 0) { | ||||
| 		err("cannot find destination for region starting at clock %lld", clock0); | ||||
| 		err("cannot find destination for region starting at clock %"PRIi64, clock0); | ||||
| 		err("consider increasing the look back size with -n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| @ -410,7 +410,7 @@ stream_check(struct stream *stream) | ||||
| 		uint64_t cur_clock = ovni_ev_get_clock(ev); | ||||
| 
 | ||||
| 		if (cur_clock < last_clock) { | ||||
| 			err("backwards jump in time %lld -> %lld for stream %s", | ||||
| 			err("backwards jump in time %"PRIi64" -> %"PRIi64" for stream %s", | ||||
| 					last_clock, cur_clock, stream->relpath); | ||||
| 			backjump = 1; | ||||
| 		} | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "player.h" | ||||
| @ -164,7 +164,7 @@ update_clocks(struct player *player, struct stream *stream) | ||||
| 	} | ||||
| 
 | ||||
| 	if (sclock < player->lastclock) { | ||||
| 		err("backwards jump in time %lld -> %lld in stream '%s'", | ||||
| 		err("backwards jump in time %"PRIi64" -> %"PRIi64" in stream '%s'", | ||||
| 				player->lastclock, sclock, stream->relpath); | ||||
| 		if (player->unsorted == 0) | ||||
| 			return -1; | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "sort.h" | ||||
| @ -165,7 +165,7 @@ sort_init(struct sort *sort, struct bay *bay, int64_t n, const char *name) | ||||
| 	/* Init and register outputs */ | ||||
| 	for (int64_t i = 0; i < n; i++) { | ||||
| 		struct chan *out = &sort->outputs[i]; | ||||
| 		chan_init(out, CHAN_SINGLE, "%s.out%lld", name, i); | ||||
| 		chan_init(out, CHAN_SINGLE, "%s.out%"PRIi64, name, i); | ||||
| 
 | ||||
| 		/* The sort module may write multiple times to the same
 | ||||
| 		 * channel if we update more than one input. */ | ||||
| @ -176,7 +176,7 @@ sort_init(struct sort *sort, struct bay *bay, int64_t n, const char *name) | ||||
| 		chan_prop_set(out, CHAN_ALLOW_DUP, 1); | ||||
| 
 | ||||
| 		if (bay_register(bay, out) != 0) { | ||||
| 			err("bay_register out%lld failed", i); | ||||
| 			err("bay_register out%"PRIi64" failed", i); | ||||
| 			return -1; | ||||
| 		} | ||||
| 	} | ||||
| @ -190,7 +190,7 @@ sort_set_input(struct sort *sort, int64_t index, struct chan *chan) | ||||
| 	struct sort_input *input = &sort->inputs[index]; | ||||
| 
 | ||||
| 	if (input->chan != NULL) { | ||||
| 		err("input %d already has a channel", index); | ||||
| 		err("input %"PRIi64" already has a channel", index); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "stream.h" | ||||
| @ -118,7 +118,7 @@ stream_load(struct stream *stream, const char *tracedir, const char *relpath) | ||||
| 		warn("stream '%s' has zero events", stream->relpath); | ||||
| 		stream->active = 0; | ||||
| 	} else { | ||||
| 		err("impossible, offset %lld bigger than size %lld", | ||||
| 		err("impossible, offset %"PRIi64" bigger than size %"PRIi64, | ||||
| 				stream->offset, stream->size); | ||||
| 		return -1; | ||||
| 	} | ||||
| @ -196,7 +196,7 @@ stream_step(struct stream *stream) | ||||
| 
 | ||||
| 		/* It cannot pass the size, otherwise we are reading garbage */ | ||||
| 		if (stream->offset > stream->size) { | ||||
| 			err("stream offset %lld exceeds size %lld", | ||||
| 			err("stream offset %"PRIi64" exceeds size %"PRIi64, | ||||
| 					stream->offset, stream->size); | ||||
| 			return -1; | ||||
| 		} | ||||
| @ -223,7 +223,7 @@ stream_step(struct stream *stream) | ||||
| 	/* Ensure the clock grows monotonically if unsorted flag not set */ | ||||
| 	if (stream->unsorted == 0) { | ||||
| 		if (clock < stream->lastclock) { | ||||
| 			err("clock goes backwards %lld -> %lld in stream '%s' at offset %lld", | ||||
| 			err("clock goes backwards %"PRIi64" -> %"PRIi64" in stream '%s' at offset %"PRIi64, | ||||
| 					stream->lastclock, | ||||
| 					clock, | ||||
| 					stream->relpath, | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "system.h" | ||||
| @ -340,10 +340,10 @@ print_system(struct system *sys) | ||||
| { | ||||
| 	err("content of system: "); | ||||
| 	for (struct loom *l = sys->looms; l; l = l->next) { | ||||
| 		err("%s gindex=%d", l->id, l->gindex); | ||||
| 		err("%s gindex=%"PRIi64, l->id, l->gindex); | ||||
| 		err("+ %zd processes: ", l->nprocs); | ||||
| 		for (struct proc *p = l->procs; p; p = p->hh.next) { | ||||
| 			err("| %s gindex=%d pid=%d", | ||||
| 			err("| %s gindex=%"PRIi64" pid=%d", | ||||
| 					p->id, p->gindex, p->pid); | ||||
| 			err("| + %d threads: ", p->nthreads); | ||||
| 			for (struct thread *t = p->threads; t; t = t->hh.next) { | ||||
| @ -353,15 +353,15 @@ print_system(struct system *sys) | ||||
| 		} | ||||
| 		err("+ %zd phy cpus: ", l->ncpus); | ||||
| 		for (struct cpu *cpu = l->cpus; cpu; cpu = cpu->hh.next) { | ||||
| 			err("| %s gindex=%lld phyid=%d", | ||||
| 			err("| %s gindex=%"PRIi64" phyid=%d", | ||||
| 					cpu->name, | ||||
| 					cpu->gindex, | ||||
| 					cpu->phyid); | ||||
| 		} | ||||
| 
 | ||||
| 		err("+ 1 virtual cpu: ", l->ncpus); | ||||
| 		err("+ 1 virtual cpu: "); | ||||
| 		struct cpu *cpu = &l->vcpu; | ||||
| 		err("| %s gindex=%lld phyid=%d", | ||||
| 		err("| %s gindex=%"PRIi64" phyid=%d", | ||||
| 				cpu->name, | ||||
| 				cpu->gindex, | ||||
| 				cpu->phyid); | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "thread.h" | ||||
| @ -18,7 +18,6 @@ | ||||
| #include "value.h" | ||||
| struct proc; | ||||
| 
 | ||||
| static const char chan_fmt[] = "thread%lu.%s"; | ||||
| static const char *chan_name[TH_CHAN_MAX] = { | ||||
| 	[TH_CHAN_CPU]   = "cpu_gindex", | ||||
| 	[TH_CHAN_TID]   = "tid_active", | ||||
| @ -159,7 +158,7 @@ thread_init_end(struct thread *th) | ||||
| 
 | ||||
| 	for (int i = 0; i < TH_CHAN_MAX; i++) { | ||||
| 		chan_init(&th->chan[i], CHAN_SINGLE, | ||||
| 				chan_fmt, th->gindex, chan_name[i]); | ||||
| 				"thread%"PRIi64".%s", th->gindex, chan_name[i]); | ||||
| 	} | ||||
| 
 | ||||
| 	/* The transition Running -> Cooling causes a duplicate (the thread is
 | ||||
| @ -327,7 +326,7 @@ thread_select_active(struct mux *mux, | ||||
| 	enum thread_state state = (enum thread_state) value.i; | ||||
| 
 | ||||
| 	if (mux->ninputs != 1) { | ||||
| 		err("mux doesn't have one input but %d", mux->ninputs); | ||||
| 		err("mux doesn't have one input but %"PRIi64, mux->ninputs); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| @ -363,7 +362,7 @@ thread_select_running(struct mux *mux, | ||||
| 	enum thread_state state = (enum thread_state) value.i; | ||||
| 
 | ||||
| 	if (mux->ninputs != 1) { | ||||
| 		err("mux doesn't have one input but %d", mux->ninputs); | ||||
| 		err("mux doesn't have one input but %"PRIi64, mux->ninputs); | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| @ -392,7 +391,7 @@ thread_set_cpu(struct thread *th, struct cpu *cpu) | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	dbg("thread%lld sets cpu%lld", th->gindex, cpu->gindex); | ||||
| 	dbg("thread%"PRIi64" sets cpu%"PRIi64, th->gindex, cpu->gindex); | ||||
| 	th->cpu = cpu; | ||||
| 
 | ||||
| 	/* Update cpu channel */ | ||||
| @ -413,7 +412,7 @@ thread_unset_cpu(struct thread *th) | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	dbg("thread%lld unsets cpu", th->gindex); | ||||
| 	dbg("thread%"PRIi64" unsets cpu", th->gindex); | ||||
| 	th->cpu = NULL; | ||||
| 
 | ||||
| 	struct chan *c = &th->chan[TH_CHAN_CPU]; | ||||
| @ -433,7 +432,7 @@ thread_migrate_cpu(struct thread *th, struct cpu *cpu) | ||||
| 		return -1; | ||||
| 	} | ||||
| 
 | ||||
| 	dbg("thread%lld migrates to cpu%lld", th->gindex, cpu->gindex); | ||||
| 	dbg("thread%"PRIi64" migrates to cpu%"PRIi64, th->gindex, cpu->gindex); | ||||
| 	th->cpu = cpu; | ||||
| 
 | ||||
| 	struct chan *c = &th->chan[TH_CHAN_CPU]; | ||||
|  | ||||
| @ -17,7 +17,7 @@ static const char **track_suffix[TRACK_TYPE_MAX] = { | ||||
| 	[TRACK_TYPE_TH] = th_suffix, | ||||
| }; | ||||
| 
 | ||||
| int __attribute__((format(printf, 5, 6))) | ||||
| int | ||||
| track_init(struct track *track, struct bay *bay, enum track_type type, int mode, const char *fmt, ...) | ||||
| { | ||||
| 	va_list ap; | ||||
|  | ||||
| @ -32,7 +32,7 @@ struct track { | ||||
| 	struct mux mux; | ||||
| }; | ||||
| 
 | ||||
| USE_RET int track_init(struct track *track, struct bay *bay, enum track_type type, int mode, const char *fmt, ...); | ||||
| USE_RET int track_init(struct track *track, struct bay *bay, enum track_type type, int mode, const char *fmt, ...) __attribute__((format(printf, 5, 6))); | ||||
| USE_RET int track_set_select(struct track *track, struct chan *sel, mux_select_func_t fsel, int64_t ninputs); | ||||
| USE_RET int track_set_input(struct track *track, int64_t index, struct chan *inp); | ||||
| USE_RET struct chan *track_get_output(struct track *track); | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "emu/mux.h" | ||||
| @ -157,11 +157,8 @@ main(void) | ||||
| 	chan_init(&output, CHAN_SINGLE, "output"); | ||||
| 	chan_init(&select, CHAN_SINGLE, "select"); | ||||
| 
 | ||||
| 	for (int i = 0; i < N; i++) { | ||||
| 		char buf[MAX_CHAN_NAME]; | ||||
| 		sprintf(buf, "input.%d", i); | ||||
| 		chan_init(&inputs[i], CHAN_SINGLE, buf); | ||||
| 	} | ||||
| 	for (int i = 0; i < N; i++) | ||||
| 		chan_init(&inputs[i], CHAN_SINGLE, "input.%d", i); | ||||
| 
 | ||||
| 	/* Register all channels in the bay */ | ||||
| 	OK(bay_register(&bay, &select)); | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include "emu/path.h" | ||||
| @ -16,7 +16,7 @@ test_underflow_trailing(void) | ||||
| 
 | ||||
| 	if (memcmp(in, out, sizeof(in)) != 0) { | ||||
| 		for (size_t i = 0; i < sizeof(in); i++) { | ||||
| 			err("i=%3d, in[i]=%02x out[i]=%02x", i, | ||||
| 			err("i=%3zd, in[i]=%02x out[i]=%02x", i, | ||||
| 					(unsigned char) in[i], | ||||
| 					(unsigned char) out[i]); | ||||
| 		} | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include <stdint.h> | ||||
| @ -28,10 +28,7 @@ test_emit(const char *path) | ||||
| 	OK(prv_open(&prv, NROWS, path)); | ||||
| 
 | ||||
| 	for (int i = 0; i < NROWS; i++) { | ||||
| 		char buf[MAX_CHAN_NAME]; | ||||
| 		sprintf(buf, "testchan.%d", i); | ||||
| 		chan_init(&chan[i], CHAN_SINGLE, buf); | ||||
| 
 | ||||
| 		chan_init(&chan[i], CHAN_SINGLE, "testchan.%d", i); | ||||
| 		OK(bay_register(&bay, &chan[i])); | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||
| /* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
 | ||||
|  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||
| 
 | ||||
| #include <stdint.h> | ||||
| @ -56,12 +56,12 @@ test_case(int64_t n, int64_t run) | ||||
| 	while (old == new) | ||||
| 		new = randint(); | ||||
| 
 | ||||
| 	dbg("-- CASE run=%lld n=%lld iold=%lld old=%lld new=%lld\n", | ||||
| 	dbg("-- CASE run=%"PRIi64" n=%"PRIi64" iold=%"PRIi64" old=%"PRIi64" new=%"PRIi64"\n", | ||||
| 			run, n, iold, old, new); | ||||
| 
 | ||||
| 	dbg("Contents before sort: "); | ||||
| 	for (int64_t i = 0; i < n; i++) { | ||||
| 		dbg("i=%lld, arr[i]=%lld, copy[i]=%lld\n", | ||||
| 		dbg("i=%"PRIi64", arr[i]=%"PRIi64", copy[i]=%"PRIi64"\n", | ||||
| 				i, arr[i], copy[i]); | ||||
| 	} | ||||
| 
 | ||||
| @ -72,7 +72,7 @@ test_case(int64_t n, int64_t run) | ||||
| 
 | ||||
| 	dbg("Contents after sort: "); | ||||
| 	for (int64_t i = 0; i < n; i++) { | ||||
| 		dbg("i=%lld, arr[i]=%lld, copy[i]=%lld\n", | ||||
| 		dbg("i=%"PRIi64", arr[i]=%"PRIi64", copy[i]=%"PRIi64"\n", | ||||
| 				i, arr[i], copy[i]); | ||||
| 	} | ||||
| 
 | ||||
| @ -94,7 +94,7 @@ test_sort_replace(void) | ||||
| 	for (int64_t n = nmin; n <= nmax; n += nstep) { | ||||
| 		for (int64_t run = 0; run < nrun; run++) | ||||
| 			test_case(n, run); | ||||
| 		err("n = %lld OK", n); | ||||
| 		err("n = %"PRIi64" OK", n); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user