The Git repository of the Libabigail Project
Go to file
Giuliano Procida f0bf868022 abg-writer.cc: Clean up new line emission.
The XML writer has a few different styles of new line handling in
different places. Some functions are responsible for line termination,
others are not and there is bespoke logic and state variables in a few
places.

Extra or missing newlines should have no impact on the semantics of
any given ABI file but they do affect textual diffs and diff
statistics.

By insisting the XML emitted should have exactly one XML tag (or
comment) per line, we can simplify the code and make it more
composable.

This commit does this, yielding a modest reduction in code size and
eliminating all blank lines in XML output (7127 blank lines in current
tests). The commit also fixes some code whitespace.

	* src/abg-writer.cc (annotate): In the
	function_decl::parameter_sptr overload, fix code whitespace.
	(write_decl_in_scope): Remove wrote_context state variable and
	associated logic; emit new line unconditionally after end of
	XML tags and nowhere else.
	(write_canonical_types_of_scope): Emit new line after end of
	XML comment and nowhere else.
	(write_translation_unit): Emit new line after end of XML tags
	and nowhere else.
	(write_type_decl): Likewise.
	(write_namespace_decl): Likewise.
	(write_qualified_type_def): Emit new line after end of XML tag.
	(write_pointer_type_def): Likewise.
	(write_reference_type_def): Likewise.
	(write_array_type_def): Emit new line after end of XML tags
	and nowhere else.
	(write_enum_type_decl): Emit new line after end of XML tag.
	(write_elf_symbol): Likewise.
	(write_elf_symbols_table): Emit no new lines.
	(write_elf_needed): Emit new line unconditionally after end of
	XML tags.
	(write_typedef_decl): Emit new line after end of XML tag.
	(write_var_decl): Emit new line after end of XML tag.
	(write_function_decl): Likewise.
	(write_function_type): Fold two output statements into
	one; emit new line after end of XML tag.
	(write_class_decl_opening_tag): Emit new line unconditionally
	after end of XML tags and simplify empty element tag logic.
	(write_union_decl_opening_tag): Likewise.
	(write_class_decl): Emit new line after end of XML tag and
	nowhere else.
	(write_union_decl): Likewise.
	(write_member_type_opening_tag): Emit new line after end of
	XML tag.
	(write_member_type): Emit new lines only after XML tags.
	(write_type_tparameter): Emit new line after XML tag.
	(write_non_type_tparameter): Likewise.
	(write_template_tparameter): Emit new line after XML tag and
	nowhere else.
	(write_type_composition): Likewise.
	(write_template_parameters): Emit no new lines.
	(write_function_tdecl): Emit new line after XML tag and
	nowhere else.
	(write_class_tdecl): Likewise.
	(write_corpus): Emit new lines only after XML tags.
	(dump): In the decl_base_sptr overload, don't emit final new
	line as this is now done by write_decl. In the var_decl_sptr
	overload, don't emit final new line (mistakenly done to cerr
	instead of o) as this is now done by write_var_decl. In the
	translation_unit overload, don't emit final new line as this
	doubles that emitted by write_translation_unit.
	* tests/data/test-annotate/libtest23.so.abi: Delete all blank
	lines.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Ditto.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Ditto.
	* tests/data/test-annotate/test-anonymous-members-0.o.abi:
	Ditto.
	* tests/data/test-annotate/test1.abi: Ditto.
	* tests/data/test-annotate/test13-pr18894.so.abi: Ditto.
	* tests/data/test-annotate/test14-pr18893.so.abi: Ditto.
	* tests/data/test-annotate/test15-pr18892.so.abi: Ditto.
	* tests/data/test-annotate/test17-pr19027.so.abi: Ditto.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Ditto.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Ditto.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Ditto.
	* tests/data/test-annotate/test21-pr19092.so.abi: Ditto.
	* tests/data/test-annotate/test7.so.abi: Ditto.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Ditto.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Ditto.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Ditto.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Ditto.
	* tests/data/test-read-dwarf/libtest23.so.abi: Ditto.
	* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi:
	Ditto.
	* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Ditto.
	* tests/data/test-read-dwarf/test1.abi: Ditto.
	* tests/data/test-read-dwarf/test1.hash.abi: Ditto.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Ditto.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Ditto.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Ditto.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Ditto.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Ditto.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Ditto.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Ditto.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Ditto.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Ditto.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Ditto.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Ditto.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Ditto.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Ditto.
	* tests/data/test-read-dwarf/test7.so.abi: Ditto.
	* tests/data/test-read-dwarf/test7.so.hash.abi: Ditto.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi:
	Ditto.
	* tests/data/test-read-write/test10.xml: Ditto.
	* tests/data/test-read-write/test15.xml: Ditto.
	* tests/data/test-read-write/test21.xml: Ditto.
	* tests/data/test-read-write/test25.xml: Ditto.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml:
	Ditto.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Ditto.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-07-09 19:10:12 +02:00
autoconf-archive Do not ignore valgrind checks returning an error 2017-02-27 10:01:15 +01:00
bash-completion Add --self-compare option in fedabipkgdiff 2017-05-31 16:21:14 +05:30
doc abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
include Support incomplete enums in core and diff code. 2020-07-08 16:59:56 +02:00
m4
scripts Clean up scripts/* 2017-04-14 04:14:12 -04:00
src abg-writer.cc: Clean up new line emission. 2020-07-09 19:10:12 +02:00
tests abg-writer.cc: Clean up new line emission. 2020-07-09 19:10:12 +02:00
tools abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
.clang-format clang-format: set continuation indentation to 2 2020-05-18 10:48:09 +02:00
.gitignore .gitignore: Add libabigail-?.* *.orig files 2019-05-22 14:34:23 +02:00
abigail.m4 abigail.m4: Fix copyright notice 2020-05-29 18:11:10 +02:00
AUTHORS
ChangeLog Update ChangeLog 2020-02-26 12:08:52 +01:00
COMMIT-LOG-GUIDELINES Update the COMMIT-LOG-GUIDELINES file 2016-05-22 23:20:12 +02:00
COMPILING Fix typo in COMPILING. 2020-02-03 13:49:54 +01:00
configure.ac Add -g back to ABIGAIL_DEVEL 2020-05-18 13:40:42 +02:00
CONTRIBUTING Control symbols exported from libabigail.so 2016-07-27 12:51:02 +02:00
COPYING Use a better wording for the COPYING file 2015-04-22 09:53:18 +02:00
COPYING-GPLV3
COPYING-LGPLV2
COPYING-LGPLV3
default.abignore Add default suppression specification for the libvirt project 2018-10-11 10:59:54 +02:00
gen-changelog.py gen-changelog.py: Update the script for python3 2020-02-26 12:06:17 +01:00
install-sh
libabigail.pc.in
ltmain.sh
Makefile.am make: add distcheck-fast target 2020-04-20 14:38:32 +02:00
NEWS Update NEWS file for 1.7 2020-02-26 12:07:29 +01:00
README Fix wording in README 2015-09-05 10:30:00 +02:00
release-text-template.txt Update the release text template after 1.0 2017-11-22 15:55:43 +01:00
update-copyright.sh Update copyright year to 2020 2020-02-21 17:05:01 +01:00
VISIBILITY Control symbols exported from libabigail.so 2016-07-27 12:51:02 +02:00

This is the Application Binary Interface Generic Analysis and
Instrumentation Library.

It aims at constructing, manipulating, serializing and de-serializing
ABI-relevant artifacts.

The set of artifacts that we are intersted is made of quantities like
types, variable, fonctions and declarations of a given library or
program.  For a given library or program this set of quantities is
called an ABI corpus.

This library aims at (among other things) providing a way to compare
two ABI Corpora (apparently the plural of corpus is copora, heh,
that's cool), provide detailed information about their differences,
and help build tools to infer interesting conclusions about these
differences.

You are welcome to contribute to this project after reading the files
CONTRIBUTING and COMMIT-LOG-GUIDELINES files in the source tree.

Communicating with the maintainers of this project -- including
sending patches to be include to the source code -- happens via email
at libabigail@sourceware.org.