18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
38c2ecf20Sopenharmony_ciout="$1"
48c2ecf20Sopenharmony_cishift
58c2ecf20Sopenharmony_ciin="$@"
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cifor i in $in; do
88c2ecf20Sopenharmony_ci	eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
98c2ecf20Sopenharmony_cidone | \
108c2ecf20Sopenharmony_ciawk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] = $2 }
118c2ecf20Sopenharmony_ci	END {   print "/* auto-generated by scripts/xen-hypercall.sh */"
128c2ecf20Sopenharmony_ci		for (i in v) if (!(v[i] in v))
138c2ecf20Sopenharmony_ci			print "HYPERCALL("substr(v[i], 14)")"}' | sort -u >$out
14