summaryrefslogtreecommitdiff
path: root/support/regression/tests/unreachable.c
blob: 4f0169b8d0f80cde8b47eba1e0a3944d782b4310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
   C2X unreachable
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c23

#include <stddef.h>

// todo: drop dis extra macro once we have c23 preprocessor support
#ifndef unreachable
#define unreachable __builtin_unreachable
#endif

volatile int i;

void f(void)
{
	if(i)
		unreachable();
}
#endif

void
testUnreachable(void)
{
#ifdef __SDCC
	if(0)
		unreachable();
	f();
#endif
}