1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-28 21:19:10 +00:00

Disable -Wregister on gperf output

Older versions of gperf use the `register` keyword which is deprecated
in C++17, and warnings are treated as errors.

This disables the warning on gperf's output (colour-names.hh). I also
renamed `colour-names.cc` -> `colour-names.hh` because we're including
it as a header, not compiling it separately.

This resolves #1865.
This commit is contained in:
Brenden Matthews 2024-04-28 11:17:12 -04:00
parent b6b9b3666e
commit 7598b89960
4 changed files with 20 additions and 14 deletions

2
.gitignore vendored
View File

@ -23,7 +23,7 @@ data/defconfig.h
*.a
/config.h
/build.h
src/colour-names.cc
src/colour-names.hh
# Compiler cache
.cache

View File

@ -47,7 +47,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h)
)
endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h)
# Generate colour-names.cc with gperf
# Generate colour-names.hh with gperf
if(APP_GPERF)
execute_process(
INPUT_FILE "${CMAKE_SOURCE_DIR}/data/color-names.yml"
@ -56,12 +56,13 @@ if(APP_GPERF)
)
execute_process(
INPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf"
OUTPUT_FILE "${CMAKE_BINARY_DIR}/colour-names.cc"
OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh"
COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
else(APP_GPERF)
message(WARNING "'gperf' program not found, using stub colour-names.cc; colors names will not be parsed")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/colour-names-stub.cc" "${CMAKE_BINARY_DIR}/colour-names.cc" COPYONLY)
message(WARNING "'gperf' program not found, using stub colour-names.hh; colors names will not be parsed")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/colour-names-stub.hh" "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh" COPYONLY)
endif(APP_GPERF)
set(conky_sources
@ -274,7 +275,6 @@ if(BUILD_GUI)
endif(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)
endif(BUILD_GUI)
if(BUILD_WAYLAND)
set(wl_srcs
wl.cc

View File

@ -1,5 +1,5 @@
/*
* To generate colour-names.cc, you must have gperf installed during build.
* To generate colour-names.hh, you must have gperf installed during build.
* This is a dummy implementation for builds without gperf.
* Color name matching will always return null (i.e. no match).
*/

View File

@ -42,7 +42,13 @@ Colour Colour::from_argb32(uint32_t argb) {
return out;
}
#include "colour-names.cc"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wregister"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wregister"
#include <colour-names.hh>
#pragma clang diagnostic pop
#pragma GCC diagnostic pop
std::optional<Colour> parse_color_name(const std::string &name) {
const rgb *value = color_name_hash::in_word_set(name.c_str(), name.length());