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