Skip to content

Commit 92c3c38

Browse files
authored
Merge pull request syslog-ng#5130 from HofiOne/further-werror-and-FreeBSD-fixes
CI: further -Werror and FreeBSD fixes
2 parents 27a57cd + 0f79341 commit 92c3c38

File tree

11 files changed

+59
-41
lines changed

11 files changed

+59
-41
lines changed

.github/workflows/devshell.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
--enable-ebpf
5656
"
5757
CMAKE_CONFIGURE_FLAGS="
58-
-DCMAKE_C_FLAGS=-Werror
58+
`[ $CC = clang ] && echo '-DENABLE_FORCE_GNU99=ON' || true`
5959
-DSUMMARY_VERBOSE=ON
6060
-DCMAKE_BUILD_TYPE=Debug
6161
-DCMAKE_INSTALL_PREFIX=${SYSLOG_NG_INSTALL_DIR}

CMakeLists.txt

+18-13
Original file line numberDiff line numberDiff line change
@@ -435,22 +435,27 @@ if (ENABLE_EXTRA_WARNINGS)
435435
-Wfloat-conversion
436436
$<$<COMPILE_LANGUAGE:C>:-Wbad-function-cast>)
437437

438-
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
439-
set(EXTRA_WARNINGS
440-
${EXTRA_WARNINGS}
441-
)
442-
else()
443-
set(EXTRA_WARNINGS
444-
$<$<COMPILE_LANGUAGE:C>:-Wold-style-declaration>
445-
-Wunused-but-set-parameter
446-
$<$<COMPILE_LANGUAGE:C>:-Woverride-init>
447-
${EXTRA_WARNINGS}
448-
)
438+
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
439+
set(EXTRA_WARNINGS
440+
${EXTRA_WARNINGS}
441+
)
442+
else()
443+
set(EXTRA_WARNINGS
444+
$<$<COMPILE_LANGUAGE:C>:-Wold-style-declaration>
445+
-Wunused-but-set-parameter
446+
$<$<COMPILE_LANGUAGE:C>:-Woverride-init>
447+
${EXTRA_WARNINGS}
448+
)
449+
endif()
449450
endif()
450451

451-
endif()
452+
add_compile_options (${IMPORTANT_WARNINGS} ${ACCEPTABLE_WARNINGS} ${EXTRA_WARNINGS})
452453

453-
add_compile_options(${IMPORTANT_WARNINGS} ${ACCEPTABLE_WARNINGS} ${EXTRA_WARNINGS})
454+
option(ENABLE_FORCE_GNU99 "Enforce C99 with gnu extensions" OFF)
455+
if (ENABLE_FORCE_GNU99)
456+
set(EXTRA_CFLAGS -std=gnu99)
457+
endif()
458+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
454459

455460
# Sanatizer configuration
456461
set(SANITIZER "OFF" CACHE STRING "Enable clang sanitizer")

cmake/print_config_summary.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ set(_maxHeaderLen 39)
3333
list(APPEND _envInfo "CMAKE_HOST_SYSTEM" "CMAKE_HOST_SYSTEM_NAME" "CMAKE_HOST_SYSTEM_PROCESSOR" "CMAKE_HOST_SYSTEM_VERSION")
3434
list(APPEND _subModules "IVYKIS_SOURCE")
3535
list(APPEND _compilersInfo "CMAKE_C_COMPILER" "CMAKE_CXX_COMPILER" "CMAKE_OBJC_COMPILER")
36-
list(APPEND _compilationsOptions "CMAKE_BUILD_TYPE" "BUILD_TESTING" "ENABLE_EXTRA_WARNINGS")
36+
list(APPEND _compilationsOptions "CMAKE_BUILD_TYPE" "BUILD_TESTING" "ENABLE_EXTRA_WARNINGS" "ENABLE_FORCE_GNU99")
3737
if(APPLE)
3838
list(APPEND _compilationsOptions "FORCE_CLASSIC_LINKING")
3939
endif()

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -2304,6 +2304,7 @@ AM_CONDITIONAL([HAVE_JAVAH], [test -n "$JAVAH_BIN"])
23042304
AM_CONDITIONAL(ENABLE_IPV6, [test $enable_ipv6 = yes])
23052305

23062306
AM_CONDITIONAL(OS_TYPE_MACOS, [test $ostype = "Darwin"])
2307+
AM_CONDITIONAL(OS_TYPE_FREEBSD, [test $ostype = "FreeBSD"])
23072308

23082309
AC_SUBST(PYTHON_VENV)
23092310
AC_SUBST(PYTHON_VENV_DIR)

modules/grpc/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ endif()
5858
module_switch(ENABLE_GRPC "Enable GRPC" GRPC_DEPS_FOUND)
5959

6060
if (ENABLE_GRPC)
61+
set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard" FORCE)
62+
set (CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "C++ standard is a requirement" FORCE)
63+
6164
include(ProtobufGenerateCpp)
6265

6366
set(MODULE_GRPC_LIBS
@@ -72,7 +75,7 @@ endif()
7275

7376
# These are intentionally not inside the above if (ENABLE_GRPC) block
7477
# Let any other possible module_switch-es take effect and is being always visible
75-
# (both modules are protected via ENABLE_GRPC as well)
78+
# (all modules are protected via ENABLE_GRPC as well)
7679
add_subdirectory(loki)
7780
add_subdirectory(otel)
7881
add_subdirectory(bigquery)
+26-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
add_unit_test(
2-
CRITERION
3-
TARGET test_otel_protobuf_parser
4-
SOURCES test-otel-protobuf-parser.cpp
5-
INCLUDES ${OTEL_PROTO_BUILDDIR}
6-
DEPENDS otel-cpp)
1+
if (NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
2+
add_unit_test (
3+
CRITERION
4+
TARGET test_otel_protobuf_parser
5+
SOURCES test-otel-protobuf-parser.cpp
6+
INCLUDES ${OTEL_PROTO_BUILDDIR}
7+
DEPENDS otel-cpp)
78

8-
add_unit_test(
9-
CRITERION
10-
TARGET test_otel_protobuf_formatter
11-
SOURCES test-otel-protobuf-formatter.cpp
12-
INCLUDES ${OTEL_PROTO_BUILDDIR}
13-
DEPENDS otel-cpp)
9+
add_unit_test (
10+
CRITERION
11+
TARGET test_otel_protobuf_formatter
12+
SOURCES test-otel-protobuf-formatter.cpp
13+
INCLUDES ${OTEL_PROTO_BUILDDIR}
14+
DEPENDS otel-cpp)
1415

15-
add_unit_test(
16-
CRITERION
17-
TARGET test_syslog_ng_otlp
18-
SOURCES test-syslog-ng-otlp.cpp
19-
INCLUDES ${OTEL_PROTO_BUILDDIR}
20-
DEPENDS otel-cpp)
16+
add_unit_test (
17+
CRITERION
18+
TARGET test_syslog_ng_otlp
19+
SOURCES test-syslog-ng-otlp.cpp
20+
INCLUDES ${OTEL_PROTO_BUILDDIR}
21+
DEPENDS otel-cpp)
2122

22-
add_unit_test(
23-
CRITERION
24-
TARGET test_otel_filterx
25-
SOURCES test-otel-filterx.cpp
26-
INCLUDES ${OTEL_PROTO_BUILDDIR}
27-
DEPENDS otel-cpp otel_filterx_logrecord_cpp)
23+
add_unit_test (
24+
CRITERION
25+
TARGET test_otel_filterx
26+
SOURCES test-otel-filterx.cpp
27+
INCLUDES ${OTEL_PROTO_BUILDDIR}
28+
DEPENDS otel-cpp otel_filterx_logrecord_cpp)
29+
endif ()

modules/grpc/otel/tests/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
if ENABLE_GRPC
22

3+
if ! OS_TYPE_FREEBSD
34
if ! OS_TYPE_MACOS
45
modules_grpc_otel_tests_TESTS = \
56
modules/grpc/otel/tests/test_otel_protobuf_parser \
@@ -9,6 +10,7 @@ modules_grpc_otel_tests_TESTS = \
910

1011
check_PROGRAMS += ${modules_grpc_otel_tests_TESTS}
1112
endif
13+
endif
1214

1315
modules_grpc_otel_tests_test_otel_protobuf_parser_SOURCES = \
1416
modules/grpc/otel/tests/test-otel-protobuf-parser.cpp

modules/grpc/protos/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,5 @@ endif
146146
EXTRA_DIST += \
147147
$(OPENTELEMETRY_PROTO_SRCDIR) \
148148
$(LOKI_PROTO_SRCDIR) \
149+
$(GRPC_PROTOS_SRCDIR)/CMakeLists.txt \
149150
$(GOOGLEAPIS_PROTO_SRCDIR)

modules/java-modules/common/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ dependencies {
1515
testImplementation 'org.hamcrest:hamcrest-core:1.3'
1616
}
1717

18+
configurations.default.setCanBeResolved(true)
19+
1820
ext.jarDestDir = project.hasProperty('jarDestDir') ? project.getProperty('jarDestDir') : '/'
1921
task copyLog4j(type: Copy) {
2022
from findJar('log4j-core')

modules/java/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ EXTRA_DIST += \
148148
modules/java/native/java-grammar.ym \
149149
modules/java/CMakeLists.txt \
150150
modules/java/tools/syslog-ng.conf.example \
151-
$(patsubst %, $(SYSLOG_NG_CORE_SRC_DIR)/%, $(JAVA_FILES))
151+
$(patsubst %, $(SYSLOG_NG_CORE_SRC_DIR)/%, $(JAVA_FILES)) \
152+
cmake/syslog_ng_core_java_native.cmake
152153

153154
.SECONDEXPANSION:
154155

syslog-ng-config.h.in

+1
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@
108108
#cmakedefine01 SYSLOG_NG_HAVE_SO_MEMINFO
109109
#cmakedefine01 SYSLOG_NG_ENABLE_AFSOCKET_MEMINFO_METRICS
110110
#cmakedefine01 SYSLOG_NG_HAVE_IV_WORK_POOL_SUBMIT_CONTINUATION
111+
#cmakedefine01 SYSLOG_NG_HAVE_DECL_CURLUE_LAST

0 commit comments

Comments
 (0)