Add libcody

Jakub Jelinek jakub@redhat.com
Thu Dec 17 10:07:32 GMT 2020


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, 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!
> 
> /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.

	Jakub



More information about the Gcc-patches mailing list