blob: 47046b3171f3573df2e5cfc8c2191760bee07f4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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"
|