From b2ba4a1f9d76a1099e257814aea1c2546fc9b789 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Wed, 18 Dec 2024 11:30:28 +0100 Subject: [PATCH] wip --- Makefile | 2 +- kernel/gzip.h | 0 kernel/io.cc | 2 ++ kernel/io.h | 5 ++++- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 kernel/gzip.h diff --git a/Makefile b/Makefile index 1506d08b95a..37cc4c47698 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST))) VPATH := $(YOSYS_SRC) CXXSTD ?= c++17 -CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -Werror=implicit-function-declaration -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include +CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include LIBS := $(LIBS) -lstdc++ -lm PLUGIN_LINKFLAGS := PLUGIN_LIBS := diff --git a/kernel/gzip.h b/kernel/gzip.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/kernel/io.cc b/kernel/io.cc index a91827c697b..e714337de3a 100644 --- a/kernel/io.cc +++ b/kernel/io.cc @@ -364,6 +364,8 @@ std::string escape_filename_spaces(const std::string& filename) PRIVATE_NAMESPACE_BEGIN +using namespace Zlib; + static const size_t GZ_BUFFER_SIZE = 8192; static void decompress_gzip(const std::string &filename, std::stringstream &out) { diff --git a/kernel/io.h b/kernel/io.h index 99b2dc62ac0..5ea110497f1 100644 --- a/kernel/io.h +++ b/kernel/io.h @@ -1,11 +1,14 @@ #include "kernel/yosys_common.h" #include +#include #ifndef YOSYS_IO_H #define YOSYS_IO_H #ifdef YOSYS_ENABLE_ZLIB +namespace Zlib { #include +} // namespace #endif YOSYS_NAMESPACE_BEGIN @@ -86,7 +89,7 @@ class gzip_ostream : public std::ostream { private: static const int buffer_size = 4096; // Size of the internal buffer char buffer[buffer_size]; // Internal buffer for compressed data - gzFile gzf = nullptr; // Handle to the gzip file + Zlib::gzFile gzf = nullptr; // Handle to the gzip file }; gzip_streambuf outbuf; // The stream buffer instance