Drop requirement to compile with GNU extensions
authorMatthias Maennich <maennich@google.com>
Fri, 5 Jul 2019 09:10:37 +0000 (10:10 +0100)
committerDodji Seketeli <dodji@redhat.com>
Tue, 9 Jul 2019 15:16:59 +0000 (17:16 +0200)
commit42cd02a9be1bfd871557be5edd40b637a70a0e11
tree5e185cbef8eb23ec6751b79a2efc678ca8c984ae
parentbb01e648ef7248cad6c172f115c2bf6edecc909f
Drop requirement to compile with GNU extensions

__gnu_cxx::stdio_filebuf is a GNU extension only available in certain
std libraries. It is not e.g. in libc++. In order to be able to compile
with using libc++, replace the usage of __gnu_cxx::stdio_filebuf with
standard C++ methods. In this case, reopen the temporary file with a
std::fstream and expose that stream rather than the previously exposed
std::iostream.

* include/abg-tools-utils.h (get_stream): Change return type to
  std::fstream
* src/abg-corpus.cc: remove unused #include of ext/stdio_filebuf.h
* src/abg-tools-utils (temp_file::priv): remove filebuf_ member,
  and replace iostream_ by fstream_ with changing the shared_ptr
  type accordingly
  (temp_file::priv::priv): initialize fstream_ based on
  temporary file name
  (temp_file::priv::~priv): adjust destruction accordingly
  (temp_file::is_good): test the fstream rather than the fd
  (temp_file::get_stream): adjust return type to std::fstream
  and adjust implementation based on the changes in temp_file::priv
* src/Makefile.am: remove gnu extension from c++ standard flag
* tests/Makefile.am: likewise

Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-tools-utils.h
src/Makefile.am
src/abg-corpus.cc
src/abg-tools-utils.cc
tests/Makefile.am