-
Notifications
You must be signed in to change notification settings - Fork 0
/
compiler.cc
51 lines (48 loc) · 2.09 KB
/
compiler.cc
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Masstree
* Eddie Kohler, Yandong Mao, Robert Morris
* Copyright (c) 2012-2014 President and Fellows of Harvard College
* Copyright (c) 2012-2014 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, subject to the conditions
* listed in the Masstree LICENSE file. These conditions include: you must
* preserve this copyright notice, and you cannot mention the copyright
* holders in advertising related to the Software without their permission.
* The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
* notice is a summary of the Masstree LICENSE file; the license in that file
* is legally binding.
*/
#include "compiler.hh"
#include <stdio.h>
#include <stdlib.h>
void fail_always_assert(const char* file, int line,
const char* assertion, const char* message) {
if (message)
fprintf(stderr, "assertion \"%s\" [%s] failed: file \"%s\", line %d\n",
message, assertion, file, line);
else
fprintf(stderr, "assertion \"%s\" failed: file \"%s\", line %d\n",
assertion, file, line);
abort();
}
void fail_masstree_invariant(const char* file, int line,
const char* assertion, const char* message) {
if (message)
fprintf(stderr, "invariant \"%s\" [%s] failed: file \"%s\", line %d\n",
message, assertion, file, line);
else
fprintf(stderr, "invariant \"%s\" failed: file \"%s\", line %d\n",
assertion, file, line);
abort();
}
void fail_masstree_precondition(const char* file, int line,
const char* assertion, const char* message) {
if (message)
fprintf(stderr, "precondition \"%s\" [%s] failed: file \"%s\", line %d\n",
message, assertion, file, line);
else
fprintf(stderr, "precondition \"%s\" failed: file \"%s\", line %d\n",
assertion, file, line);
abort();
}