Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search.cpp: -Werror unused-function #66

Closed
lanodan opened this issue Oct 24, 2017 · 1 comment
Closed

search.cpp: -Werror unused-function #66

lanodan opened this issue Oct 24, 2017 · 1 comment
Assignees
Labels

Comments

@lanodan
Copy link

lanodan commented Oct 24, 2017

$ meson . build
The Meson build system
Version: 0.41.2
Source dir: /mnt/gentoo/home/haelwenn/Sources/git/github.com/openzim/libzim
Build dir: /mnt/gentoo/home/haelwenn/Sources/git/github.com/openzim/libzim/build
Build type: native build
Project name: libzim
Native c compiler: cc (gcc 5.4.0)
Native cpp compiler: c++ (gcc 5.4.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.28)
Native dependency zlib found: YES 1.2.11
Native dependency liblzma found: YES 5.2.3
Dependency xapian-core found: NO
Dependency threads found: YES
Native dependency icu-i18n found: YES 58.2
Downloading gtest from https://github.com/google/googletest/archive/release-1.8.0.zip
Download size: 1586287
Downloading: ..........
Downloading patch from https://wrapdb.mesonbuild.com/v1/projects/gtest/1.8.0/4/get_zip
Download size: 1277
Downloading: ..........

Executing subproject gtest.

Project name: gtest
Native cpp compiler: c++ (gcc 5.4.0)
Build targets in project: 0

Subproject gtest finished.
Configuring config.h using configuration
Build targets in project: 9
$ cd build
$ ninja
[19/49] Compiling Cpp object 'src/zim@sha/search.cpp.o'.
FAILED: src/zim@sha/search.cpp.o
c++  -Isrc/zim@sha -Isrc -I../src -Iinclude -I../include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64-Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -O0 -g -Werror -Wall -fPIC -pthread -MMD -MQ 'src/zim@sha/search.cpp.o' -MF 'src/zim@sha/search.cpp.o.d' -o 'src/zim@sha/search.cpp.o' -c ../src/search.cpp
../src/search.cpp:59:28: error: ‘std::map<std::__cxx11::basic_string<char>, int> zim::{anonymous}::read_valuesmap(const string&)’ defined but not used [-Werror=unused-function]
 std::map<std::string, int> read_valuesmap(const std::string &s) {
                            ^
cc1plus: all warnings being treated as errors
[24/49] Compiling Cpp object 'src/zim@sha/writer_zimcreatorimpl.cpp.o'.
ninja: build stopped: subcommand failed.

Please test your code when using -Werror publicly, you should be using it only on your side or with an option if you know it can break.

@kelson42 kelson42 added the bug label Oct 24, 2017
mgautierfr added a commit that referenced this issue Oct 30, 2017
Some function are used only if we are compiling libzim with xapian
support.

As we are compiler libzim with `-Werror`, we should not have defined but
not used function.

Let's move function definition in the correct `ENABLE_XAPIAN` guard.

Fix #66.
@mgautierfr
Copy link
Collaborator

Those functions are used only when libzim is compiled with xapian.

I haven't libzim without xapian since I've added the -Werror flag.

Now, those function are defined only if we compile with xapian. This should be ok.

kelson42 pushed a commit that referenced this issue Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants