1 // CODYlib -*- mode:c++ -*-
2 // Copyright (C) 2019-2020 Nathan Sidwell, nathan@acm.org
3 // License: Apache v2.0
17 void (AssertFailed
) (Location loc
) noexcept
19 (HCF
) ("assertion failed", loc
);
21 void (Unreachable
) (Location loc
) noexcept
23 (HCF
) ("unreachable reached", loc
);
27 void (HCF
) (char const *msg
32 { // HCF - you goofed!
35 constexpr Location
loc (nullptr, 0);
38 fprintf (stderr
, "CODYlib: %s", msg
? msg
: "internal error");
39 if (char const *file
= loc
.File ())
41 char const *src
= SRCDIR
;
45 size_t l
= strlen (src
);
47 if (!strncmp (src
, file
, l
) && file
[l
] == '/')
50 fprintf (stderr
, " at %s:%u", file
, loc
.Line ());
52 fprintf (stderr
, "\n");