]> granicus.if.org Git - clang/commitdiff
Add script for checking builtin macros verse another compiler ($CC or
authorDaniel Dunbar <daniel@zuster.org>
Sun, 5 Oct 2008 20:39:30 +0000 (20:39 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 5 Oct 2008 20:39:30 +0000 (20:39 +0000)
gcc).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57133 91177308-0d34-0410-b5e6-96231b3b80d8

utils/CheckBuiltinMacros.sh [new file with mode: 0755]

diff --git a/utils/CheckBuiltinMacros.sh b/utils/CheckBuiltinMacros.sh
new file mode 100755 (executable)
index 0000000..6a8573c
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -ex
+
+if [ -z "$CC" ]; then
+    CC="gcc"
+fi
+
+SRCLANG=c
+MACROLIST=macro-list.txt
+CCDEFS=cc-definitions.txt
+CLANGDEFS=clang-definitions.txt
+
+# Gather list of macros as "NAME" = NAME.
+$CC -dM -E -x $SRCLANG /dev/null -o - | \
+grep "#define" | sort -f | sed -e "s/#define \([^ ]*\) .*/\"\1\" = \1/" > $MACROLIST
+
+$CC -E -x $SRCLANG $MACROLIST > $CCDEFS
+
+clang -E -x $SRCLANG $MACROLIST > $CLANGDEFS
+
+diff $CCDEFS $CLANGDEFS
+
+