summaryrefslogtreecommitdiff
path: root/tests/scanner/regress.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2019-09-04 19:39:25 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2019-09-15 17:12:45 +0000
commit073dcd088215c4eaafe90a256e398b83327888e6 (patch)
tree53117303d734ff3651243e043b2fc8c67f763f71 /tests/scanner/regress.c
parentd08b5019099a6375563ede434d29038e6916256e (diff)
downloadgobject-introspection-073dcd088215c4eaafe90a256e398b83327888e6.tar.gz
Support array arguments with static keyword
C99 allows defining an array argument with a fixed size as: void foo (int arr[static 10]) Compilers conforming to the C99 specification will be able to warn if the function is called with NULL or with an array smaller than the specified length, something that does not happen when using pre-C99 declarations like: void foo (int arr[10]) As the declaration above is identical to: void foo (int arr[]) Which is, in turn, identical to: void foo (int *arr) Fixes: #309
Diffstat (limited to 'tests/scanner/regress.c')
-rw-r--r--tests/scanner/regress.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index bc04079c..3a63436b 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -865,6 +865,22 @@ regress_test_array_fixed_size_int_return (void)
}
/**
+ * regress_test_array_static_in_int
+ * @x: (array fixed-size=10): a list of 10 integers
+ */
+#if (defined(__GNUC__) || defined(__clang__)) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+void
+regress_test_array_static_in_int (int x[static 10])
+{
+}
+#else
+void
+regress_test_array_static_in_int (int x[10])
+{
+}
+#endif
+
+/**
* regress_test_strv_out_c:
*
* Returns: (transfer none):