gcc/libcody/fatal.cc
Nathan Sidwell e2aa8a5f98 libcody: Simplify configure [PR 98414, 98509]
Libcody's configurey was overly 'clever'.  That didn't play well with
GCC's structure.  This removes lots of that overengineering, using
libcpp as an example.

	libcody/
	* Makefile.in: Remove auto parallelize, swallow Makesub.in. Don't
	check compiler name here.
	* Makesub.in: Delete.
	* build-aux/config.guess: Delete.
	* build-aux/config.sub: Delete.
	* build-aux/install-sh: Delete.
	* dox.cfg.in: Delete.
	* gdbinit.in: Delete.
	* internal.hh (BuildNote): Delete.
	* fatal.cc (BuildNote): Delete.
	* config.m4: Remove unneeded fns.
	* configure.ac: Remove unneccessary checks and configures.
	* configure: Rebuilt.
	* config.h.in: Rebuilt.
2021-01-12 10:32:27 -08:00

58 lines
1022 B
C++

// CODYlib -*- mode:c++ -*-
// Copyright (C) 2019-2020 Nathan Sidwell, nathan@acm.org
// License: Apache v2.0
// Cody
#include "internal.hh"
// C
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
namespace Cody {
#if NMS_CHECKING
void (AssertFailed) (Location loc) noexcept
{
(HCF) ("assertion failed", loc);
}
void (Unreachable) (Location loc) noexcept
{
(HCF) ("unreachable reached", loc);
}
#endif
void (HCF) (char const *msg
#if NMS_CHECKING
, Location const loc
#endif
) noexcept
{ // HCF - you goofed!
#if !NMS_CHECKING
constexpr Location loc (nullptr, 0);
#endif
fprintf (stderr, "CODYlib: %s", msg ? msg : "internal error");
if (char const *file = loc.File ())
{
char const *src = SRCDIR;
if (src[0])
{
size_t l = strlen (src);
if (!strncmp (src, file, l) && file[l] == '/')
file += l + 1;
}
fprintf (stderr, " at %s:%u", file, loc.Line ());
}
fprintf (stderr, "\n");
raise (SIGABRT);
exit (2);
}
}