#!/bin/sh # lib9p/tests/test_compile.c.gen - Generate code to make sure all generated macros work # # Copyright (C) 2025 Luke T. Shumaker # SPDX-License-Identifier: AGPL-3.0-or-later generated_h=$1 outfile=$2 { echo "/* ${outfile} - Generated by $0. DO NOT EDIT! */" echo echo "#include " 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"