diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/regression/Makefile | 2 | ||||
-rw-r--r-- | test/regression/annot1.c | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile index 44e1718e..55b07f56 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 00000000..42ab826f --- /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; +} + |