When a typedef is defined for an anonymous struct like this:
typedef struct {
uint8_t *base;
size_t len;
} nghttp2_vec;
ctest will generate a test like this:
CTEST_EXTERN uint64_t ctest_size_of__nghttp2_vec(void) { return sizeof(struct nghttp2_vec); }
Unfortunately, in the original typedef, the struct was never named. This makes struct nghttp2_vec invalid. This leads to build errors like:
warning: systest@0.1.0: /Users/runner/work/libnghttp2-sys/libnghttp2-sys/target/debug/build/systest-11de373a3de40a3c/out/ctest.c:807:65: error: invalid application of 'sizeof' to an incomplete type 'struct nghttp2_vec'
warning: systest@0.1.0: 807 | CTEST_EXTERN uint64_t ctest_size_of__nghttp2_vec(void) { return sizeof(struct nghttp2_vec); }
warning: systest@0.1.0: | ^ ~~~~~~~~~~~~~~~~~~~~
warning: systest@0.1.0: /Users/runner/work/libnghttp2-sys/libnghttp2-sys/target/debug/build/systest-11de373a3de40a3c/out/ctest.c:807:79: note: forward declaration of 'struct nghttp2_vec'
warning: systest@0.1.0: 807 | CTEST_EXTERN uint64_t ctest_size_of__nghttp2_vec(void) { return sizeof(struct nghttp2_vec); }
warning: systest@0.1.0: | ^
Instead, the test should probably use nghttp2_vec instead of struct nghttp2_vec.
When a typedef is defined for an anonymous struct like this:
ctest will generate a test like this:
Unfortunately, in the original typedef, the struct was never named. This makes
struct nghttp2_vecinvalid. This leads to build errors like:warning: systest@0.1.0: /Users/runner/work/libnghttp2-sys/libnghttp2-sys/target/debug/build/systest-11de373a3de40a3c/out/ctest.c:807:65: error: invalid application of 'sizeof' to an incomplete type 'struct nghttp2_vec' warning: systest@0.1.0: 807 | CTEST_EXTERN uint64_t ctest_size_of__nghttp2_vec(void) { return sizeof(struct nghttp2_vec); } warning: systest@0.1.0: | ^ ~~~~~~~~~~~~~~~~~~~~ warning: systest@0.1.0: /Users/runner/work/libnghttp2-sys/libnghttp2-sys/target/debug/build/systest-11de373a3de40a3c/out/ctest.c:807:79: note: forward declaration of 'struct nghttp2_vec' warning: systest@0.1.0: 807 | CTEST_EXTERN uint64_t ctest_size_of__nghttp2_vec(void) { return sizeof(struct nghttp2_vec); } warning: systest@0.1.0: | ^Instead, the test should probably use
nghttp2_vecinstead ofstruct nghttp2_vec.