Skip to content

Commit ab7beca

Browse files
authored
Merge pull request syslog-ng#5133 from HofiOne/turn-on-werror-everywhere
Turn on -Werror everywhere
2 parents 37ed777 + 256e2a6 commit ab7beca

19 files changed

+42
-12
lines changed

.github/workflows/devshell.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
PYTHONUSERBASE="${HOME}/python_packages"
4141
CC="${{ matrix.cc }}"
4242
CXX=`[ $CC = gcc ] && echo g++ || echo clang++`
43+
CFLAGS="-Werror -Wno-unused-command-line-argument"
44+
CXXFLAGS="${CFLAGS}"
4345
SYSLOG_NG_INSTALL_DIR=${HOME}/install/syslog-ng
4446
CONFIGURE_FLAGS="
4547
`[ $CC = clang ] && echo '--enable-force-gnu99' || true`
@@ -66,7 +68,7 @@ jobs:
6668
-DENABLE_JAVA_MODULES=OFF
6769
-DENABLE_EBPF=ON
6870
"
69-
gh_export COREFILES_DIR PYTHONUSERBASE CC CXX SYSLOG_NG_INSTALL_DIR CONFIGURE_FLAGS CMAKE_CONFIGURE_FLAGS
71+
gh_export COREFILES_DIR PYTHONUSERBASE CC CXX SYSLOG_NG_INSTALL_DIR CFLAGS CXXFLAGS CONFIGURE_FLAGS CMAKE_CONFIGURE_FLAGS
7072
gh_path "${PYTHONUSERBASE}"
7173
7274
- name: autogen.sh
@@ -129,8 +131,8 @@ jobs:
129131
run: |
130132
REPORTS_DIR=tests/light/reports
131133
cp -r ${REPORTS_DIR} /tmp/light-reports
132-
find /tmp/light-reports -type p,s -print0 | xargs -0 rm -f
133-
tar -cz -f /tmp/light-reports.tar.gz /tmp/light-reports
134+
find /tmp/light-reports -type p,s -print0 | xargs -0 rm -f
135+
tar -cz -f /tmp/light-reports.tar.gz /tmp/light-reports
134136
135137
- name: "Artifact: light-reports"
136138
uses: actions/[email protected]

.github/workflows/macos.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ jobs:
6565
SYSLOG_NG_INSTALL_DIR="${HOME}/install/syslog-ng"
6666
PYTHONUSERBASE="${HOME}/python_packages"
6767
THREADS="$(sysctl -n hw.physicalcpu)"
68-
CFLAGS="-I${HOMEBREW_PREFIX}/include/ -I${MACPORTS_PREFIX}/include"
68+
CFLAGS="-I${HOMEBREW_PREFIX}/include/ -I${MACPORTS_PREFIX}/include -Werror -Wno-unused-command-line-argument"
69+
CXXFLAGS="${CFLAGS}"
6970
LDFLAGS="-L${HOMEBREW_PREFIX}/lib -L${MACPORTS_PREFIX}/lib"
7071
CONFIGURE_FLAGS="
7172
`[ $CC = clang ] && echo '--enable-force-gnu99' || true`
@@ -80,22 +81,23 @@ jobs:
8081
--disable-java
8182
--disable-java-modules
8283
"
84+
# -DIVYKIS_SOURCE=internal is switched to system temporally as of https://github.com/buytenh/ivykis/pulls
8385
CMAKE_CONFIGURE_FLAGS="
8486
`[ $CC = clang ] && echo '-DENABLE_FORCE_GNU99=ON' || true`
8587
-DSUMMARY_VERBOSE=ON
8688
-DCMAKE_BUILD_TYPE=Debug
8789
-DCMAKE_INSTALL_PREFIX=${SYSLOG_NG_INSTALL_DIR}
8890
-DBUILD_TESTING=ON
8991
-DPYTHON_VERSION=3
90-
-DIVYKIS_SOURCE=internal
92+
-DIVYKIS_SOURCE=system
9193
-DENABLE_JOURNALD=OFF
9294
-DENABLE_JAVA=OFF
9395
-DENABLE_JAVA_MODULES=OFF
9496
"
9597
PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig:${HOMEBREW_PREFIX}/opt/net-snmp/lib/pkgconfig:${HOMEBREW_PREFIX}/lib/pkgconfig:${MACPORTS_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
9698
PATH="${HOMEBREW_PREFIX}/opt/bison/bin:${HOMEBREW_PREFIX}/opt/libnet/bin:${HOMEBREW_PREFIX}/opt/net-snmp/bin:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:${PYTHONUSERBASE}/bin:${MACPORTS_PREFIX}/bin:${MACPORTS_PREFIX}/sbin:${PATH}"
9799
98-
gh_export HOMEBREW_PREFIX MACPORTS_PREFIX SYSLOG_NG_INSTALL_DIR PYTHONUSERBASE CC CXX PKG_CONFIG_PATH THREADS CONFIGURE_FLAGS CFLAGS LDFLAGS CMAKE_CONFIGURE_FLAGS PATH
100+
gh_export HOMEBREW_PREFIX MACPORTS_PREFIX SYSLOG_NG_INSTALL_DIR PYTHONUSERBASE CC CXX PKG_CONFIG_PATH THREADS CONFIGURE_FLAGS CFLAGS CXXFLAGS LDFLAGS CMAKE_CONFIGURE_FLAGS PATH
99101
gh_path "${PATH}"
100102
101103
echo "ARCH: " $(arch)
@@ -115,10 +117,7 @@ jobs:
115117
- name: cmake configure
116118
if: matrix.build-tool == 'cmake'
117119
run: |
118-
# If you know the valid syntax to provide the quoted string for -DCMAKE_C_FLAGS inplace in CMAKE_CONFIGURE_FLAGS above
119-
# (in Set ENV variables step) instead of this hack, please contribute!
120-
#
121-
cmake --install-prefix "${SYSLOG_NG_INSTALL_DIR}" -B build . -DCMAKE_C_FLAGS="${CFLAGS} -Werror" ${CMAKE_CONFIGURE_FLAGS}
120+
cmake --install-prefix "${SYSLOG_NG_INSTALL_DIR}" -B build . ${CMAKE_CONFIGURE_FLAGS}
122121
123122
- name: cmake install
124123
if: matrix.build-tool == 'cmake'

modules/grpc/bigquery/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ add_module(
3535
)
3636

3737
set_target_properties(bigquery PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/syslog-ng")
38+
39+
target_compile_options (bigquery-cpp PRIVATE -Wno-switch-default -Wno-double-promotion -Wno-deprecated -Wno-inconsistent-missing-override -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0)

modules/grpc/bigquery/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ modules_grpc_bigquery_libbigquery_cpp_la_SOURCES = \
1313

1414
modules_grpc_bigquery_libbigquery_cpp_la_CXXFLAGS = \
1515
$(AM_CXXFLAGS) \
16+
-Wno-switch-default -Wno-double-promotion -Wno-deprecated -Wno-inconsistent-missing-override -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 \
1617
$(PROTOBUF_CFLAGS) \
1718
$(GRPCPP_CFLAGS) \
1819
-I$(GOOGLEAPIS_PROTO_BUILDDIR) \

modules/grpc/bigquery/bigquery-dest.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class ErrorCollector : public google::protobuf::compiler::MultiFileErrorCollecto
7979
}
8080

8181
private:
82+
#if (defined(__clang__) && __clang_major__ >= 10)
83+
#pragma GCC diagnostic ignored "-Winconsistent-missing-override"
84+
#endif
8285
/* deprecated interface */
8386
void AddError(const std::string &filename, int line, int column, const std::string &message)
8487
{

modules/grpc/loki/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ add_module(
3535
SOURCES ${LOKI_SOURCES}
3636
)
3737

38+
target_compile_options(loki-cpp PRIVATE -Wno-deprecated -Wno-double-promotion -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0)
39+
3840
set_target_properties(loki PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/syslog-ng")

modules/grpc/loki/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ modules_grpc_loki_libloki_cpp_la_SOURCES = \
1414

1515
modules_grpc_loki_libloki_cpp_la_CXXFLAGS = \
1616
$(AM_CXXFLAGS) \
17+
-Wno-deprecated -Wno-double-promotion -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 \
1718
$(PROTOBUF_CFLAGS) \
1819
$(GRPCPP_CFLAGS) \
1920
-I$(LOKI_PROTO_BUILDDIR) \

modules/grpc/otel/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ add_module(
5353

5454
set_target_properties(otel PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/syslog-ng")
5555

56+
target_compile_options (otel-cpp PRIVATE -Wno-double-promotion -Wno-deprecated -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0)
57+
5658
add_subdirectory(filterx)
5759
target_link_libraries(otel PRIVATE otel_filterx_logrecord_cpp)
5860

modules/grpc/otel/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ modules_grpc_otel_libotel_cpp_la_SOURCES = \
3131

3232
modules_grpc_otel_libotel_cpp_la_CXXFLAGS = \
3333
$(AM_CXXFLAGS) \
34+
-Wno-double-promotion -Wno-deprecated -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 \
3435
$(PROTOBUF_CFLAGS) \
3536
$(GRPCPP_CFLAGS) \
3637
-I$(OPENTELEMETRY_PROTO_BUILDDIR) \

modules/grpc/otel/filterx/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ add_module(
3030
LIBRARY_TYPE STATIC
3131
)
3232

33-
set_target_properties(otel_filterx_logrecord_cpp PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations")
33+
target_compile_options (otel_filterx_logrecord_cpp PRIVATE -Wno-switch-default -Wno-double-promotion -Wno-deprecated -Wno-deprecated-declarations -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0)

modules/grpc/otel/filterx/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ modules_grpc_otel_filterx_libfilterx_la_SOURCES = \
2222

2323
modules_grpc_otel_filterx_libfilterx_la_CXXFLAGS = \
2424
$(AM_CXXFLAGS) \
25+
-Wno-switch-default -Wno-double-promotion -Wno-deprecated -Wno-deprecated-declarations -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 \
2526
$(PROTOBUF_CFLAGS) \
2627
$(GRPCPP_CFLAGS) \
2728
-I$(OPENTELEMETRY_PROTO_BUILDDIR) \

modules/grpc/otel/filterx/object-otel-array.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Array::Array(FilterXOtelArray *s) :
4141
array(new ArrayValue()),
4242
borrowed(false)
4343
{
44+
if (super && super->super.get_subscript)
45+
; // silence private field 'super' is not used [-Werror,-Wunused-private-field]
4446
}
4547

4648
Array::Array(FilterXOtelArray *s, ArrayValue *a) :

modules/grpc/otel/filterx/object-otel-kvlist.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ KVList::KVList(FilterXOtelKVList *s) :
4242
repeated_kv(new RepeatedPtrField<KeyValue>()),
4343
borrowed(false)
4444
{
45+
if (super && super->super.support_attr)
46+
; // silence private field 'super' is not used [-Werror,-Wunused-private-field]
4547
}
4648

4749
KVList::KVList(FilterXOtelKVList *s, RepeatedPtrField<KeyValue> *k) :

modules/grpc/otel/filterx/object-otel-logrecord.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ using namespace syslogng::grpc::otel::filterx;
4545

4646
LogRecord::LogRecord(FilterXOtelLogRecord *super_) : super(super_)
4747
{
48+
if (super && super_->super.type)
49+
; // silence private field 'super' is not used [-Werror,-Wunused-private-field]
4850
}
4951

5052
LogRecord::LogRecord(FilterXOtelLogRecord *super_, FilterXObject *protobuf_object) : super(super_)

modules/grpc/otel/filterx/object-otel-resource.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ using namespace syslogng::grpc::otel::filterx;
3535

3636
Resource::Resource(FilterXOtelResource *s) : super(s)
3737
{
38+
if (super && super->super.type)
39+
; // silence private field 'super' is not used [-Werror,-Wunused-private-field]
3840
}
3941

4042
Resource::Resource(FilterXOtelResource *s, FilterXObject *protobuf_object) : super(s)

modules/grpc/otel/filterx/object-otel-scope.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ using namespace syslogng::grpc::otel::filterx;
3535

3636
Scope::Scope(FilterXOtelScope *s) : super(s)
3737
{
38+
if (super && super->super.type)
39+
; // silence private field 'super' is not used [-Werror,-Wunused-private-field]
3840
}
3941

4042
Scope::Scope(FilterXOtelScope *s, FilterXObject *protobuf_object) : super(s)

modules/grpc/otel/otel-protobuf-formatter.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ _set_KeyValue_log_msg_foreach_fn(NVHandle handle, const gchar *name, const gchar
327327
static SeverityNumber
328328
_get_log_msg_severity_number(LogMessage *msg)
329329
{
330+
#if (defined(__clang__) && __clang_major__ >= 10)
331+
# pragma GCC diagnostic ignored "-Wc99-designator"
332+
#endif
330333
static SeverityNumber mapping[] =
331334
{
332335
[LOG_EMERG] = SeverityNumber::SEVERITY_NUMBER_FATAL,
@@ -1381,4 +1384,6 @@ ProtobufFormatter::format(LogMessage *msg, Span &span)
13811384
syslogng::grpc::otel::ProtobufFormatter::ProtobufFormatter(GlobalConfig *cfg_)
13821385
: cfg(cfg_)
13831386
{
1387+
if (cfg)
1388+
; // silence private field 'cfg' is not used [-Werror,-Wunused-private-field]
13841389
}

modules/grpc/protos/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ target_include_directories(grpc-protos
9191
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}
9292
)
9393

94-
target_compile_options(grpc-protos PRIVATE -Wno-switch-default)
94+
target_compile_options(grpc-protos PRIVATE -Wno-switch-default -Wno-double-promotion -Wno-deprecated -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0)
9595
install(TARGETS grpc-protos LIBRARY DESTINATION lib/syslog-ng COMPONENT grpc-protos)

modules/grpc/protos/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ modules_grpc_protos_libgrpc_protos_la_SOURCES = \
115115

116116
modules_grpc_protos_libgrpc_protos_la_CXXFLAGS = \
117117
$(AM_CXXFLAGS) \
118+
-Wno-switch-default -Wno-double-promotion -Wno-deprecated -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 \
118119
$(PROTOBUF_CFLAGS) \
119120
$(GRPCPP_CFLAGS) \
120121
-I$(GOOGLEAPIS_PROTO_SRCDIR) \

0 commit comments

Comments
 (0)