xref: /netbsd-src/external/mit/isl/dist/isl_test_cpp17-checked.cc (revision 5971e316fdea024efff6be8f03536623db06833e)
1*5971e316Smrg #include <stdlib.h>
2*5971e316Smrg 
3*5971e316Smrg #include <exception>
4*5971e316Smrg #include <iostream>
5*5971e316Smrg 
6*5971e316Smrg #include <isl/options.h>
7*5971e316Smrg #include <isl/cpp-checked.h>
8*5971e316Smrg 
9*5971e316Smrg /* Select the "checked" interface.
10*5971e316Smrg  */
11*5971e316Smrg namespace isl { using namespace checked; }
12*5971e316Smrg 
13*5971e316Smrg /* Print an error message and abort.
14*5971e316Smrg  */
die_impl(const char * file,int line,const char * message)15*5971e316Smrg static void die_impl(const char *file, int line, const char *message)
16*5971e316Smrg {
17*5971e316Smrg 	std::cerr << file << ":" << line << ": " << message << "\n";
18*5971e316Smrg 	exit(EXIT_FAILURE);
19*5971e316Smrg }
20*5971e316Smrg 
21*5971e316Smrg #define die(msg) die_impl(__FILE__, __LINE__, msg)
22*5971e316Smrg 
23*5971e316Smrg #include "isl_test_cpp17-generic.cc"
24*5971e316Smrg 
25*5971e316Smrg /* Test the C++17 specific features of the isl checked C++ interface
26*5971e316Smrg  *
27*5971e316Smrg  * In particular, test
28*5971e316Smrg  *  - id::try_user
29*5971e316Smrg  */
main()30*5971e316Smrg int main()
31*5971e316Smrg {
32*5971e316Smrg 	isl_ctx *ctx = isl_ctx_alloc();
33*5971e316Smrg 
34*5971e316Smrg 	isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
35*5971e316Smrg 
36*5971e316Smrg 	test_try_user(ctx);
37*5971e316Smrg 
38*5971e316Smrg 	isl_ctx_free(ctx);
39*5971e316Smrg 
40*5971e316Smrg 	return EXIT_SUCCESS;
41*5971e316Smrg }
42