On 12/17/20 5:07 AM, Jakub Jelinek wrote:
On Thu, Dec 17, 2020 at 11:01:40AM +0100, Andreas Schwab wrote:
On Dez 15 2020, Nathan Sidwell wrote:
diff --git c/libcody/fatal.cc w/libcody/fatal.cc
new file mode 100644
index 00000000000..b35094e6b19
--- /dev/null
+++ w/libcody/fatal.cc
@@ -0,0 +1,78 @@
+// CODYlib -*- mode:c++ -*-
+// Copyright (C) 2019-2020 Nathan Sidwell, nat...@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!
/tmp/ccabCPZ7.s: Assembler messages:
/tmp/ccabCPZ7.s:28: Error: Wrong number of input operands
Yeah. If it is meant as an optimization barrier, shouldn't it be just
__asm__ volatile ("");
or
__asm__ volatile ("" : : : "memory");
? That said, shouldn't that be guarded on the compiler being GCC
(or some other that supports inline asm)? Not all compilers have to support
that.
I can just take it out -- the reason it is there is so when you set a
breapoint on HCF (via a .gdbinit), gdb will land you at one of those two
lines, which is a great way of telling you where you are.
--
Nathan Sidwell