edit
[c11concurrency-benchmarks.git] / silo / masstree / compiler.cc
1 /* Masstree
2  * Eddie Kohler, Yandong Mao, Robert Morris
3  * Copyright (c) 2012-2014 President and Fellows of Harvard College
4  * Copyright (c) 2012-2014 Massachusetts Institute of Technology
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, subject to the conditions
9  * listed in the Masstree LICENSE file. These conditions include: you must
10  * preserve this copyright notice, and you cannot mention the copyright
11  * holders in advertising related to the Software without their permission.
12  * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13  * notice is a summary of the Masstree LICENSE file; the license in that file
14  * is legally binding.
15  */
16 #include "compiler.hh"
17 #include <stdio.h>
18 #include <stdlib.h>
19
20 void fail_always_assert(const char* file, int line,
21                         const char* assertion, const char* message) {
22     if (message)
23         fprintf(stderr, "assertion \"%s\" [%s] failed: file \"%s\", line %d\n",
24                 message, assertion, file, line);
25     else
26         fprintf(stderr, "assertion \"%s\" failed: file \"%s\", line %d\n",
27                 assertion, file, line);
28     abort();
29 }
30
31 void fail_masstree_invariant(const char* file, int line,
32                              const char* assertion, const char* message) {
33     if (message)
34         fprintf(stderr, "invariant \"%s\" [%s] failed: file \"%s\", line %d\n",
35                 message, assertion, file, line);
36     else
37         fprintf(stderr, "invariant \"%s\" failed: file \"%s\", line %d\n",
38                 assertion, file, line);
39     abort();
40 }
41
42 void fail_masstree_precondition(const char* file, int line,
43                                 const char* assertion, const char* message) {
44     if (message)
45         fprintf(stderr, "precondition \"%s\" [%s] failed: file \"%s\", line %d\n",
46                 message, assertion, file, line);
47     else
48         fprintf(stderr, "precondition \"%s\" failed: file \"%s\", line %d\n",
49                 assertion, file, line);
50     abort();
51 }