diff mbox series

Fix declaratons of conditionally defined functions

Message ID 20210302221112.30655-1-woodard@redhat.com
State New
Headers show
Series Fix declaratons of conditionally defined functions | expand

Commit Message

Ben Woodard March 2, 2021, 10:11 p.m. UTC
Functions relating to zip archives are declared but are never compiled
when --enable-zip-archive=no, the default.

This makes sure that they are not declared when they won't be defined
due to conditional compilation.

Signed-off-by: Ben Woodard <woodard@redhat.com>
---
 include/abg-reader.h | 4 +++-
 tools/abilint.cc     | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Dodji Seketeli March 8, 2021, 12:34 p.m. UTC | #1
Hello Ben,

Ben Woodard via Libabigail <libabigail@sourceware.org> a écrit:

> Functions relating to zip archives are declared but are never compiled
> when --enable-zip-archive=no, the default.
>
> This makes sure that they are not declared when they won't be defined
> due to conditional compilation.
>
> Signed-off-by: Ben Woodard <woodard@redhat.com>

I have amended the commit log to add the ChangeLog part as explained in
the document
https://sourceware.org/git/?p=libabigail.git;a=blob;f=COMMIT-LOG-GUIDELINES.

So here is what the adjusted commit log looks like:

Functions relating to zip archives are declared but are never compiled
when --enable-zip-archive=no, the default.

This makes sure that they are not declared when they won't be defined
due to conditional compilation.

	* include/abg-reader.h (read_corpus_from_file): Guard the
	declaration of these overloads with #ifdef WITH_ZIP_ARCHIVE.
	* tools/abilint.cc: Guard the use of
	abigail::xml_reader::read_corpus_from_file with #ifdef
	WITH_ZIP_ARCHIVE.

Other than that, the patch looks good to me and I have applied to
master.

Thanks!

[...]

Cheers,
diff mbox series

Patch

diff --git a/include/abg-reader.h b/include/abg-reader.h
index 70851c86..f1408912 100644
--- a/include/abg-reader.h
+++ b/include/abg-reader.h
@@ -52,7 +52,8 @@  create_native_xml_read_context(std::istream* in, environment* env);
 const string&
 read_context_get_path(const read_context&);
 
-abigail::corpus_sptr
+#ifdef WITH_ZIP_ARCHIVE
+corpus_sptr
 read_corpus_from_file(const string& path);
 
 int
@@ -61,6 +62,7 @@  read_corpus_from_file(corpus_sptr& corp,
 
 int
 read_corpus_from_file(corpus_sptr& corp);
+#endif //WITH_ZIP_ARCHIVE
 
 corpus_sptr
 read_corpus_from_native_xml(std::istream* in,
diff --git a/tools/abilint.cc b/tools/abilint.cc
index aaf500f7..fb7b0781 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -48,7 +48,6 @@  using abigail::corpus;
 using abigail::corpus_sptr;
 using abigail::xml_reader::read_translation_unit_from_file;
 using abigail::xml_reader::read_translation_unit_from_istream;
-using abigail::xml_reader::read_corpus_from_file;
 using abigail::xml_reader::read_corpus_from_native_xml;
 using abigail::xml_reader::read_corpus_from_native_xml_file;
 using abigail::xml_reader::read_corpus_group_from_input;
@@ -58,6 +57,9 @@  using abigail::xml_writer::write_context_sptr;
 using abigail::xml_writer::create_write_context;
 using abigail::xml_writer::write_corpus;
 using abigail::xml_writer::write_corpus_to_archive;
+#ifdef WITH_ZIP_ARCHIVE
+using abigail::xml_reader::read_corpus_from_file;
+#endif
 
 struct options
 {