Daniel Dunbar | 7b6d8c4 | 2008-10-05 20:39:30 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | set -ex |
| 3 | |
| 4 | if [ -z "$CC" ]; then |
| 5 | CC="gcc" |
| 6 | fi |
| 7 | |
| 8 | SRCLANG=c |
| 9 | MACROLIST=macro-list.txt |
| 10 | CCDEFS=cc-definitions.txt |
| 11 | CLANGDEFS=clang-definitions.txt |
| 12 | |
| 13 | # Gather list of macros as "NAME" = NAME. |
| 14 | $CC -dM -E -x $SRCLANG /dev/null -o - | \ |
| 15 | grep "#define" | sort -f | sed -e "s/#define \([^ ]*\) .*/\"\1\" = \1/" > $MACROLIST |
| 16 | |
| 17 | $CC -E -x $SRCLANG $MACROLIST > $CCDEFS |
| 18 | |
| 19 | clang -E -x $SRCLANG $MACROLIST > $CLANGDEFS |
| 20 | |
| 21 | diff $CCDEFS $CLANGDEFS |
| 22 | |
| 23 | |