diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-20 19:27:04 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-22 17:03:39 -0600 |
commit | e3cb318792bc8570869c93d8219306cf61b9b007 (patch) | |
tree | 129e44abe79a4ab8a96dad8e2d548c5d364c2384 /lib9p/tests/test_compile.c.gen | |
parent | 83b1f50d4d5d5fdba71e27a833e550f06262cdb5 (diff) |
lib9p: Add a test that generated macros compile
Diffstat (limited to 'lib9p/tests/test_compile.c.gen')
-rwxr-xr-x | lib9p/tests/test_compile.c.gen | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib9p/tests/test_compile.c.gen b/lib9p/tests/test_compile.c.gen new file mode 100755 index 0000000..47046b3 --- /dev/null +++ b/lib9p/tests/test_compile.c.gen @@ -0,0 +1,19 @@ +#!/bin/sh +# lib9p/tests/test_compile.c.gen - Generate code to make sure all generated macros work +# +# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com> +# SPDX-License-Identifier: AGPL-3.0-or-later + +generated_h=$1 +outfile=$2 + +{ + echo "/* ${outfile} - Generated by $0. DO NOT EDIT! */" + echo + echo "#include <lib9p/9p.h>" + echo 'int main(void) {' + echo ' [[gnu::unused]] uint64_t x;' + sed -nE 's/^\s*#\s*define\s*(\S[^ (]*)\s.*/ x = \1;/p' <"$generated_h" + echo ' return 0;' + echo '}' +} >"$outfile" |