Snaipe / libcsptr

Smart pointers for the (GNU) C programming language
https://snai.pe/c/c-smart-pointers/
MIT License
1.57k stars 143 forks source link

Fail to compile #15

Closed Skallwar closed 2 years ago

Skallwar commented 4 years ago

I can't compile the project. Here is the output:

/tmp/libcsptr/check/test/utils.h: In function ‘make_test_case’: /tmp/libcsptr/check/test/utils.h:26:28: error: passing argument 2 of ‘_tcase_add_test’ from incompatible pointer type [-Werror=incompatible-pointer-types] 26 tcase_add_test(tc, *f); ^
TFun {aka void (*)(int)}

/usr/include/check.h:331:69: note: expected ‘const TTest ’ {aka ‘const struct TTest ’} but argument is of type ‘TFun’ {aka ‘void ()(int)’} 331 | CK_DLL_EXP void CK_EXPORT _tcase_add_test(TCase tc, const TTest * ttest, | ~~~~^~~ cc1: all warnings being treated as errors

However without libcheck installed, I can compile without problem

Snaipe commented 4 years ago

-Werror is pretty much always a mistake to use for these exact cases. Do you mind sending a PR removing it from the defaults flags in CMakeLists.txt?

multun commented 4 years ago

@Snaipe the warning actually looks nasty here, some function expects a struct and gets a function pointer

Skallwar commented 4 years ago

What's strange here is that there is no problem when libcheck is uninstalled. There seems to be a conflict

Snaipe commented 4 years ago

Check seems to have changed the function signature to take a struct TTest instead of a TFun when they released 0.13.0. The tests would need to be fixed, but tbf I might just as well use Criterion for testing.

ijustlovemath commented 4 years ago

@Snaipe doesn't criterion use libcsptr under the hood? So this bug still affects them