aboutsummaryrefslogtreecommitdiff
path: root/libctf/Makefile.in
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-06-02 19:07:08 +0100
committerNick Alcock <nick.alcock@oracle.com>2020-07-22 17:57:20 +0100
commit7eea9d3bdb037a3953101eccdb05826daf2da39a (patch)
tree9146958b0707822dabf56fc5e30381b0122f16e3 /libctf/Makefile.in
parentb64751cf0bc4466066c35e6c63348f900ce10272 (diff)
downloadgdb-7eea9d3bdb037a3953101eccdb05826daf2da39a.zip
gdb-7eea9d3bdb037a3953101eccdb05826daf2da39a.tar.gz
gdb-7eea9d3bdb037a3953101eccdb05826daf2da39a.tar.bz2
libctf: restructure error handling to reduce relocations
Jose Marchesi noted that the traditional-Unix error array in ctf-error.c introduces one reloc per error to initialize the array: 58 so far. We can reduce this to zero using an array of carefully-sized individual members which is used to construct a string table, that is then referenced by the lookup functions: but doing this automatically is a pain. Bruno Haible wrote suitable code years ago: I got permission to reuse it (Bruno says "... which I hereby put in the public domain"); I modified it a tiny bit (similarly to what Ulrich Drepper did in the dsohowto text, but I redid it from scratch), commented it up a bit, and shifted the error table into that form, migrating it into the new file ctf-error.h. This has the advantage that it spotted both typos in the text of the errors in the comments in ctf-api.h and typos in the error defines in the comments in ctf-error.c, and places where the two were simply not in sync. All are now fixed. One new constant exists in ctf-api.h: CTF_NERR, since the old method of working out the number of errors in ctf-error.c was no longer usable, and it seems that the number of CTF errors is something users might reasonably want as well. It should be pretty easy to keep up to date as new errors are introduced. include/ * ctf-api.h (ECTF_*): Improve comments. (ECTF_NERR): New. libctf/ * ctf-error.c: Include <stddef.h>, for offsetof. (_ctf_errlist): Migrate to... (_ctf_errlist_t): ... this. (_ctf_erridx): New, indexes into _ctf_errlist_t. (_ctf_nerr): Remove. (ctf_errmsg): Adjust accordingly. * Makefile.am (BUILT_SOURCES): Note... (ctf-error.h): ... this new rule. * Makefile.in: Regenerate. * mkerrors.sed: New, process ctf-api.h to generate ctf-error.h. * .gitignore: New, ignore ctf-error.h.
Diffstat (limited to 'libctf/Makefile.in')
-rw-r--r--libctf/Makefile.in15
1 files changed, 11 insertions, 4 deletions
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index 9e6f255..a26fa31 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -452,7 +452,8 @@ libctf_la_LIBADD = @BFD_LIBADD@ $(libctf_nobfd_la_LIBADD)
libctf_la_DEPENDENCIES = @BFD_DEPENDENCIES@
libctf_la_LDFLAGS = $(libctf_nobfd_la_LDFLAGS)
libctf_la_SOURCES = $(libctf_nobfd_la_SOURCES) ctf-open-bfd.c
-all: config.h
+BUILT_SOURCES = ctf-error.h
+all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
@@ -855,13 +856,15 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -891,6 +894,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
@@ -965,7 +969,7 @@ ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
-.MAKE: all install-am install-strip
+.MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \
@@ -989,6 +993,9 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.PRECIOUS: Makefile
+ctf-error.h: $(srcdir)/mkerrors.sed $(srcdir)/../include/ctf-api.h
+ sed -nf $(srcdir)/mkerrors.sed < $(srcdir)/../include/ctf-api.h > $@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: