362303298a
In order to separate compiler from build system, C++ Modules, as implemented in GCC introduces a communication channel between those two entities. This is implemented by libcody. It is anticipated that other implementations will also implement this protocol, or use libcody to provide it. * Makefile.def: Add libcody. * configure.ac: Add libcody. * Makefile.in: Regenerated. * configure: Regenerated. gcc/ * Makefile.in (CODYINC, CODYLIB, CODYLIB_H): New. Use them. libcody/ * configure.ac: New. * CMakeLists.txt: New. * CODING.md: New. * CONTRIB.md: New. * LICENSE: New. * LICENSE.gcc: New. * Makefile.in: New. * Makesub.in: New. * README.md: New. * buffer.cc: New. * build-aux/config.guess: New. * build-aux/config.sub: New. * build-aux/install-sh: New. * client.cc: New. * cmake/libcody-config-ix.cmake * cody.hh: New. * config.h.in: New. * config.m4: New. * configure: New. * configure.ac: New. * dox.cfg.in: New. * fatal.cc: New. * gdbinit.in: New. * internal.hh: New. * netclient.cc: New. * netserver.cc: New. * packet.cc: New. * resolver.cc: New. * server.cc: New. * tests/01-serialize/connect.cc: New. * tests/01-serialize/decoder.cc: New. * tests/01-serialize/encoder.cc: New. * tests/02-comms/client-1.cc: New. * tests/02-comms/pivot-1.cc: New. * tests/02-comms/server-1.cc: New. * tests/Makesub.in: New. * tests/jouster: New.
79 lines
1.5 KiB
C++
79 lines
1.5 KiB
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!
|
|
__asm__ volatile ("nop"); // 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);
|
|
}
|
|
|
|
void BuildNote (FILE *stream) noexcept
|
|
{
|
|
fprintf (stream, "Version %s.\n", PACKAGE_NAME " " PACKAGE_VERSION);
|
|
fprintf (stream, "Report bugs to %s.\n", BUGURL[0] ? BUGURL : "you");
|
|
if (PACKAGE_URL[0])
|
|
fprintf (stream, "See %s for more information.\n", PACKAGE_URL);
|
|
if (REVISION[0])
|
|
fprintf (stream, "Source %s.\n", REVISION);
|
|
|
|
fprintf (stream, "Build is %s & %s.\n",
|
|
#if !NMS_CHECKING
|
|
"un"
|
|
#endif
|
|
"checked",
|
|
#if !__OPTIMIZE__
|
|
"un"
|
|
#endif
|
|
"optimized");
|
|
}
|
|
|
|
}
|