From 99f47c7a99b11c9cc3429fc0e5d0e21ae3707518 Mon Sep 17 00:00:00 2001 From: xleroy Date: Wed, 1 Sep 2010 08:36:03 +0000 Subject: Adding __builtin_annotation git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1497 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- test/regression/Makefile | 2 +- test/regression/annot1.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/regression/annot1.c (limited to 'test') 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 + +/* 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; +} + -- cgit v1.2.3