libctf doesn't build with Solaris sed

Tom Tromey tom@tromey.com
Mon Oct 19 19:41:01 GMT 2020


>>>>> "Simon" == Simon Marchi via Binutils <binutils@sourceware.org> writes:

Simon> Normally, it should be like this:

Simon>     _CTF_STR (ECTF_FMT, "File is not in CTF or ELF format")
Simon>     _CTF_STR (ECTF_BFDERR, "BFD error")

Simon> I presume that there is some GNU-ism in mkerrors.sed.  When I replace
Simon> sed with gsed in the Makefile, it gets generated correctly.

Simon> If the script can be made to work with all seds, then great.  Otherwise,
Simon> you could verify that sed is GNU sed and allow the user to pass SED=gsed
Simon> or something.

Simon> Also, "make clean" does not remove ctf-error.h, I think it should.

It seems to me that ctf-error.h could be removed entirely by changing
this enum to a ".defs"-like file (see include/dwarf2.def for an example)
or a C macro that can be used to expand multiple ways.

.defs are used pretty frequently in gdb and gcc.  The C macro trick is
to do something like:

#define BLAH \
   EXPAND (ONE, 1),
   EXPAND (TWO, 2)

Then create the enum with

enum mumble {
#define EXPAND(A, B) A
BLAH
#undef EXPAND
}

.. i.e., the same thing without a separate file.

Tom


More information about the Binutils mailing list