Skip to content

Instantly share code, notes, and snippets.

@Alexhuszagh
Last active January 6, 2018 21:33
Show Gist options
  • Save Alexhuszagh/a9f15028b14e886adf240d65d365670c to your computer and use it in GitHub Desktop.
Save Alexhuszagh/a9f15028b14e886adf240d65d365670c to your computer and use it in GitHub Desktop.
Trace Macro Expansion of Type or Function
#!/bin/bash
# Use as `./macro.sh $CC $HEADER $MACRO`, where CC is the
# C or C++ compiler desired. There must be an arg1, arg2,
# arg3, and, or the script will quit.
if [ "$#" -ne 3 ]; then
echo "Use: ./.sh.sh \$CC \$HEADER \$MACRO."
echo "Must invoke with exactly 3 args."
exit 1
fi
echo | $1 -E -xc -include $2 - | grep $3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment