diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/Sema/static-array.c | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/Sema/static-array.c')
-rw-r--r-- | clang/test/Sema/static-array.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Sema/static-array.c b/clang/test/Sema/static-array.c new file mode 100644 index 0000000..2d4b968 --- /dev/null +++ b/clang/test/Sema/static-array.c @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void cat0(int a[static 0]) {} // expected-warning {{'static' has no effect on zero-length arrays}} + +void cat(int a[static 3]) {} // expected-note 2 {{callee declares array parameter as static here}} + +typedef int i3[static 3]; +void tcat(i3 a) {} + +void vat(int i, int a[static i]) {} // expected-note {{callee declares array parameter as static here}} + +void f(int *p) { + int a[2], b[3], c[4]; + + cat0(0); + + cat(0); // expected-warning {{null passed to a callee which requires a non-null argument}} + cat(a); // expected-warning {{array argument is too small; contains 2 elements, callee requires at least 3}} + cat(b); + cat(c); + cat(p); + + tcat(0); // expected-warning {{null passed to a callee which requires a non-null argument}} + tcat(a); // expected-warning {{array argument is too small; contains 2 elements, callee requires at least 3}} + tcat(b); + tcat(c); + tcat(p); + + vat(1, 0); // expected-warning {{null passed to a callee which requires a non-null argument}} + vat(3, b); +} |