Add ptrs-as-arrays tests
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
ee4638ab10
commit
07c3aed03e
@@ -0,0 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
extern "C" {
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
|
||||
} // extern "C"
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
|
||||
|
||||
void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
|
||||
|
||||
void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
|
||||
|
||||
void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
|
||||
|
||||
void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,19 @@
|
||||
/// cbindgen:ptrs-as-arrays=[[arg;3]]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ptr_as_array(n: u32, arg: *const u32, v: *const u64) {}
|
||||
|
||||
/// cbindgen:ptrs-as-arrays=[[arg;3], [v; 4]]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ptr_as_array1(n: u32, arg: *const u32, v: *mut u64) {}
|
||||
|
||||
/// cbindgen:ptrs-as-arrays=[[n;2], [arg; ], [v;], [k; 3]]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ptr_as_array2(n: u32, arg: *mut u32, v: *const u64) {}
|
||||
|
||||
/// cbindgen:ptrs-as-arrays=[[a;2;3]]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ptr_as_array_wrong_syntax(arg: *mut u32, v: *const u32, _: *const u32) {}
|
||||
|
||||
/// cbindgen:ptrs-as-arrays=[[_;2], [_;3]]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ptr_as_array_unnamed(_: *mut u32, _: *const u32) {}
|
||||
Reference in New Issue
Block a user