projects
/
ccan
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
First cut, some hacks, three simple modules.
[ccan]
/
container_of
/
test
/
compile_fail-bad-type.c
1
#include "container_of/container_of.h"
2
#include <stdlib.h>
3
4
struct foo {
5
int a;
6
char b;
7
};
8
9
int main(int argc, char *argv[])
10
{
11
struct foo foo = { .a = 1, .b = 2 };
12
int *intp = &foo.a;
13
char *p;
14
15
#ifdef FAIL
16
p = container_of(intp, struct foo, a);
17
#else
18
p = (char *)intp;
19
#endif
20
return p == NULL;
21
}