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

Including glog/logging.h triggers -Wunused-parameter on g++ #493

Closed
ednolan opened this issue Nov 6, 2019 · 1 comment · Fixed by #540
Closed

Including glog/logging.h triggers -Wunused-parameter on g++ #493

ednolan opened this issue Nov 6, 2019 · 1 comment · Fixed by #540
Milestone

Comments

@ednolan
Copy link

ednolan commented Nov 6, 2019

The following script demonstrates the issue:

#!/bin/bash
# install glog to glog_prefix
git clone https://github.com/google/glog.git
mkdir -p glog_prefix
cd glog
mkdir build
cd build
cmake3 -DCMAKE_INSTALL_PREFIX=../../glog_prefix \
       -DCMAKE_BUILD_TYPE=Release \
       -DWITH_GFLAGS=OFF \
       ..
make -j$(nproc --ignore=1)
make install
cd ../..

# build a cpp file that includes glog
cat <<EOF > test.cpp
#include <glog/logging.h>
int main(int, char**) { return 0; }
EOF
g++ -o test -Wall -Wextra -Iglog_prefix/include -Lglog_prefix/lib64 -lglog test.cpp

Expected output: no compiler warning
Actual output:

In file included from test.cpp:1:0:
glog_prefix/include/glog/logging.h:1434:16: warning: unused parameter 'usecs' [-Wunused-parameter]
   virtual void send(LogSeverity severity, const char* full_filename,
                ^

Operating system: CentOS 7.6.1810
gcc version: 4.8.5 (also tested with gcc 8.2.0)

@ednolan
Copy link
Author

ednolan commented Nov 17, 2019

# install glog to glog_prefix
git clone https://github.com/google/glog.git
mkdir -p glog_prefix
cd glog
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../../glog_prefix \
       -DCMAKE_BUILD_TYPE=Release \
       -DWITH_GFLAGS=OFF \
       ..
make -j$(nproc --ignore=1)
make install
cd ../..

# build a cpp file that includes glog
cat <<EOF > test.cpp
#include <glog/logging.h>
int main(int, char**) { return 0; }
EOF
g++ -o test -Wall -Wextra -Iglog_prefix/include -Lglog_prefix/lib -lglog test.cpp

Above is a slightly modified version of the script that triggers the issue on Ubuntu 18.04 LTS with gcc 7.4.0

@sergiud sergiud added this to the 0.5 milestone Mar 30, 2021
@sergiud sergiud mentioned this issue May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants