3 #include "analyzer-decls.h"
13 __analyzer_eval (i
!= 42); /* { dg-warning "TRUE" } */
30 __analyzer_eval (i
!= 0); /* { dg-warning "TRUE" } */
33 /**************************************************************************/
35 void calls_abort (const char *msg
)
37 fprintf (stderr
, "%s", msg
);
41 void test_3 (void *ptr
)
44 calls_abort ("ptr was NULL");
46 __analyzer_eval (ptr
!= 0); /* { dg-warning "TRUE" } */
49 /**************************************************************************/
51 extern void marked_noreturn (const char *msg
)
52 __attribute__ ((__noreturn__
));
54 void test_4 (void *ptr
)
57 marked_noreturn ("ptr was NULL");
59 __analyzer_eval (ptr
!= 0); /* { dg-warning "TRUE" } */
62 /**************************************************************************/
64 /* Verify that we discover conditions from assertions if the assert macro
65 isn't disabled, and that it has its failure-handler labelled with
66 __attribute__ ((__noreturn__)).
67 This attribute isn't present for all implementations of <assert.h>, so
68 we have to test the idea using our own assert macro. */
70 extern void my_assert_fail (const char *expr
, const char *file
, int line
)
71 __attribute__ ((__noreturn__
));
73 #define MY_ASSERT(EXPR) \
74 do { if (!(EXPR)) my_assert_fail (#EXPR, __FILE__, __LINE__); } while (0)
79 __analyzer_eval (i
< 10); /* { dg-warning "TRUE" } */