diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-03-27 15:40:45 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-03-29 15:14:30 +1030 |
commit | be25ab9c8df2f96ee10929fdfee582935b2f0e06 (patch) | |
tree | cbd376ec8d2cc9bb25d2bf8057829fdf27ae7f1f /lib | |
parent | 3acce707a32a28c309133583b8cd1a554f19a8b3 (diff) | |
download | samba-be25ab9c8df2f96ee10929fdfee582935b2f0e06.tar.gz samba-be25ab9c8df2f96ee10929fdfee582935b2f0e06.tar.bz2 samba-be25ab9c8df2f96ee10929fdfee582935b2f0e06.zip |
cast: test/compile_fail-cast_static.c should fail without COMPOUND_LITERALS.
It still gave a warning on gcc, because casting a char to a char* gives a warning. Not so on sun CC.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 6569a707d169a629e25e10710c760c8dc84525c7)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ccan/cast/test/compile_fail-cast_static.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/ccan/cast/test/compile_fail-cast_static.c b/lib/ccan/cast/test/compile_fail-cast_static.c index 0f9e478047..a4ebf61b1a 100644 --- a/lib/ccan/cast/test/compile_fail-cast_static.c +++ b/lib/ccan/cast/test/compile_fail-cast_static.c @@ -3,15 +3,21 @@ int main(int argc, char *argv[]) { - char c; + long c; #ifdef FAIL char * #else - long + char #endif x = 0; - c = cast_static(char, x); + c = cast_static(long, x); (void) c; /* Suppress unused-but-set-variable warning. */ return 0; } + +#ifdef FAIL +#if !HAVE_COMPOUND_LITERALS +#error "Unfortunately we don't fail if cast_static without compound literals" +#endif +#endif |