]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf, ld, binutils, include: API review: ctf_error_t/ctf_ret_t/ctf_bool_t
authorNick Alcock <nick.alcock@oracle.com>
Wed, 5 Nov 2025 13:58:00 +0000 (13:58 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 9 Dec 2025 13:02:30 +0000 (13:02 +0000)
commit22c3b2abc3bd5d6327c44bc7c89244826b2df86d
tree1bc57011ef632ed3919664845b78e796b758bcd6
parentfc283b5aa17fb94b3087cfbc1d03cebe89e7b0d5
libctf, ld, binutils, include: API review: ctf_error_t/ctf_ret_t/ctf_bool_t

This first round of the libctf API review changes a whole pile of
apparently-identical int return types and function parameters into
typedefs that more clearly denote their purpose: ctf_error_t is a
positive ECTF_* or errno error value, ctf_ret_t is 0 or -1 on error, and
ctf_bool_t is 0/1 (true/false), or -1 for error.

(Doing this teased multiple bugs out of libctf itself where we were
accidentally returning the wrong things in obscure error paths, so just
using ints for all three cases was clearly too hard even for the
libctf authors, let alone for users.)

This is ABI-compatible, but it still requires (trivial) source changes
in callers to avoid -Wincompatible-pointer-types warnings.

Many more invasive changes coming.
25 files changed:
binutils/objdump.c
binutils/readelf.c
gdb/ctfread.c
include/ctf-api.h
ld/ldlang.c
libctf/ctf-api.c
libctf/ctf-archive.c
libctf/ctf-create.c
libctf/ctf-decl.c
libctf/ctf-dedup.c
libctf/ctf-dump.c
libctf/ctf-error.c
libctf/ctf-hash.c
libctf/ctf-impl.h
libctf/ctf-inlines.h
libctf/ctf-link.c
libctf/ctf-lookup.c
libctf/ctf-open-bfd.c
libctf/ctf-open.c
libctf/ctf-serialize.c
libctf/ctf-string.c
libctf/ctf-types.c
libctf/testsuite/libctf-lookup/enumerator-iteration.c
libctf/testsuite/libctf-writable/parent-child-dtd-crash-lib.c
libctf/testsuite/libctf-writable/symtypetab-nonlinker-writeout.c