summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-09-01 08:36:03 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-09-01 08:36:03 +0000
commit99f47c7a99b11c9cc3429fc0e5d0e21ae3707518 (patch)
treef452a9d6f8ec4c4573a7ca55581a0060d315f510 /test
parent1b8e228a2c5d8f63ffa28c1fcef68f64a0408900 (diff)
Adding __builtin_annotation
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1497 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test')
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/annot1.c23
2 files changed, 24 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index 44e1718..55b07f5 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -13,7 +13,7 @@ TESTS=bitfields1 bitfields2 bitfields3 bitfields4 \
funct3 expr5 struct7 struct8 casts1 casts2
# Other tests: should compile to .s without errors (but expect warnings)
-EXTRAS=commaprec expr2 expr3 expr4 extern1 funct2 funptr1 init1 \
+EXTRAS=annot1 commaprec expr2 expr3 expr4 extern1 funct2 funptr1 init1 \
init2 init3 init4 pragmas ptrs1 ptrs2 sizeof1 struct1 struct2 struct3 \
struct4 struct5 struct6 types1 volatile1
diff --git a/test/regression/annot1.c b/test/regression/annot1.c
new file mode 100644
index 0000000..42ab826
--- /dev/null
+++ b/test/regression/annot1.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+/* Annotations */
+
+int f(int x, int y)
+{
+ return __builtin_annotation("f(%1,%2)", x, y);
+}
+
+double g(double x)
+{
+ return __builtin_annotation("g(%1 + 1.0)", x + 1.0);
+}
+
+int main()
+{
+ __builtin_annotation("calling f");
+ printf("f returns %d\n", f(12, 34));
+ __builtin_annotation("calling g");
+ printf("f returns %.2f\n", g(3.14));
+ return 0;
+}
+