Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/infinite-loop-g_error.c

raw
1 /* Reduced from glib, which has a g_error macro with this infinite
2 loop in it:
3 for (;;) ;
4
5 Make sure we provide a readable warning for this case. */
6
7 extern void g_log_structured_standard (const char *);
8
9 #define g_error(MSG) \
10 do { \
11 g_log_structured_standard (MSG); \
12 for (;;) ; \
13 } while (0)
14 /* { dg-message "5: infinite loop" "" { target *-*-* } .-2 } */
15
16 void test_g_error (void)
17 {
18 g_error ("something went wrong"); /* { dg-message "in expansion of macro 'g_error'" } */
19 }