diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-09-04 19:39:25 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-09-15 17:12:45 +0000 |
commit | 073dcd088215c4eaafe90a256e398b83327888e6 (patch) | |
tree | 53117303d734ff3651243e043b2fc8c67f763f71 /tests/scanner/regress.h | |
parent | d08b5019099a6375563ede434d29038e6916256e (diff) | |
download | gobject-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.h')
-rw-r--r-- | tests/scanner/regress.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index cf5302e4..d1c7b437 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -867,6 +867,13 @@ void regress_forced_method (RegressTestObj *obj); _GI_TEST_EXTERN void regress_test_array_fixed_out_objects (RegressTestObj ***objs); +#if (defined(__GNUC__) || defined(__clang__)) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +_GI_TEST_EXTERN +void regress_test_array_static_in_int (int x[static 10]); +#else +_GI_TEST_EXTERN +void regress_test_array_static_in_int (int x[10]); +#endif _GI_TEST_EXTERN void regress_test_obj_torture_signature_0 (RegressTestObj *obj, |