test-sizeof: print pointer sizes

This is useful information, I don't know why we forgot to add it there.

gcc doesn't like arithemetic on a pointer to a function or void*, so don't
print signedness info there. It doesn't matter anyway.
C says function pointers can be different... Though I guess our code isn't
prepared for that.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-09-04 18:32:43 +02:00
parent a9030b81c1
commit d11578f30e

View file

@ -16,6 +16,11 @@
DISABLE_WARNING_TYPE_LIMITS;
#define info_no_sign(t) \
printf("%s → %zu bits, %zu byte alignment\n", STRINGIFY(t), \
sizeof(t)*CHAR_BIT, \
__alignof__(t))
#define info(t) \
printf("%s → %zu bits%s, %zu byte alignment\n", STRINGIFY(t), \
sizeof(t)*CHAR_BIT, \
@ -37,6 +42,12 @@ enum BigEnum2 {
};
int main(void) {
int (*function_pointer)(void);
info_no_sign(function_pointer);
info_no_sign(void*);
info(char*);
info(char);
info(signed char);
info(unsigned char);