Merge branch 'topic/timw/werror'

* topic/timw/werror:
  CI: Remove unused openssl30_config
  CPP-gen: Don't emit extra braces if only one element
  Use <poll.h> instead of <sys/poll.h>
  ZAM: Create ListValPtr directly instead of a stack object
  Bump zeekjs to pick up dprintf warning fix
  Avoid unused-result warning in Supervisor
  Update src/3rdparty submodule to fix sprintf warning in modp
  Fix warning with attribute string lookup
  Set -Werror / /WX via target_compile_options to force warnings as errors
This commit is contained in:
Tim Wojtulewicz 2024-01-08 14:10:44 -07:00
commit 985e1f9024
14 changed files with 86 additions and 21 deletions

View file

@ -10,13 +10,12 @@ btest_jobs: &BTEST_JOBS 4
btest_retries: &BTEST_RETRIES 2
memory: &MEMORY 16GB
config: &CONFIG --build-type=release --disable-broker-tests --prefix=$CIRRUS_WORKING_DIR/install --ccache
no_spicy_config: &NO_SPICY_CONFIG --build-type=release --disable-broker-tests --disable-spicy --prefix=$CIRRUS_WORKING_DIR/install --ccache
static_config: &STATIC_CONFIG --build-type=release --disable-broker-tests --enable-static-broker --enable-static-binpac --prefix=$CIRRUS_WORKING_DIR/install --ccache
asan_sanitizer_config: &ASAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=address --enable-fuzzers --enable-coverage --disable-spicy --ccache
ubsan_sanitizer_config: &UBSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=undefined --enable-fuzzers --disable-spicy --ccache
tsan_sanitizer_config: &TSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=thread --enable-fuzzers --disable-spicy --ccache
openssl30_config: &OPENSSL30_CONFIG --build-type=release --disable-broker-tests --with-openssl=/opt/openssl --prefix=$CIRRUS_WORKING_DIR/install --ccache
config: &CONFIG --build-type=release --disable-broker-tests --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
no_spicy_config: &NO_SPICY_CONFIG --build-type=release --disable-broker-tests --disable-spicy --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
static_config: &STATIC_CONFIG --build-type=release --disable-broker-tests --enable-static-broker --enable-static-binpac --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
asan_sanitizer_config: &ASAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=address --enable-fuzzers --enable-coverage --disable-spicy --ccache --enable-werror
ubsan_sanitizer_config: &UBSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=undefined --enable-fuzzers --disable-spicy --ccache --enable-werror
tsan_sanitizer_config: &TSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=thread --enable-fuzzers --disable-spicy --ccache --enable-werror
resources_template: &RESOURCES_TEMPLATE
cpu: *CPUS

33
CHANGES
View file

@ -1,3 +1,36 @@
6.2.0-dev.337 | 2024-01-08 14:10:44 -0700
* Merge branch 'topic/timw/werror' (Tim Wojtulewicz, Corelight)
* topic/timw/werror:
CI: Remove unused openssl30_config
CPP-gen: Don't emit extra braces if only one element
Use <poll.h> instead of <sys/poll.h>
ZAM: Create ListValPtr directly instead of a stack object
Bump zeekjs to pick up dprintf warning fix
Avoid unused-result warning in Supervisor
Update src/3rdparty submodule to fix sprintf warning in modp
Fix warning with attribute string lookup
Set -Werror / /WX via target_compile_options to force warnings as errors
* CI: Remove unused openssl30_config (Tim Wojtulewicz, Corelight)
* CPP-gen: Don't emit extra braces if only one element (Tim Wojtulewicz, Corelight)
* Use <poll.h> instead of <sys/poll.h> (Tim Wojtulewicz, Corelight)
* ZAM: Create ListValPtr directly instead of a stack object (Tim Wojtulewicz, Corelight)
* Bump zeekjs to pick up dprintf warning fix (Tim Wojtulewicz, Corelight)
* Avoid unused-result warning in Supervisor (Tim Wojtulewicz, Corelight)
* Update src/3rdparty submodule to fix sprintf warning in modp (Tim Wojtulewicz, Corelight)
* Fix warning with attribute string lookup (Tim Wojtulewicz, Corelight)
* Set -Werror / /WX via target_compile_options to force warnings as errors (Tim Wojtulewicz, Corelight)
6.2.0-dev.327 | 2024-01-08 10:04:49 -0700
* Update broker to pick up Windows 2-minute exception fix (Tim Wojtulewicz, Corelight)

View file

@ -165,8 +165,18 @@ if (MSVC)
# Disable Spicy as it is not yet supported in Windows.
set(DISABLE_SPICY true)
if (BUILD_WITH_WERROR)
# TODO: This is disabled for now because there a bunch of known
# compiler warnings on Windows that we don't have good fixes for.
#set(WERROR_FLAG "/WX")
#set(WERROR_FLAG "/WX")
endif ()
else ()
include(GNUInstallDirs)
if (BUILD_WITH_WERROR)
set(WERROR_FLAG "-Werror")
endif ()
endif ()
include(cmake/CommonCMakeConfig.cmake)
@ -254,6 +264,7 @@ endif ()
foreach (name zeek_exe zeek_lib zeek_fuzzer_shared)
if (TARGET ${name})
target_compile_definitions(${name} PRIVATE ZEEK_CONFIG_SKIP_VERSION_H)
target_compile_options(${name} PRIVATE ${WERROR_FLAG})
endif ()
endforeach ()
@ -347,6 +358,7 @@ function (zeek_add_subdir_library name)
add_dependencies(${target_name} zeek_autogen_files)
target_link_libraries(${target_name} PRIVATE $<BUILD_INTERFACE:zeek_internal>)
add_clang_tidy_files(${FN_ARGS_SOURCES})
target_compile_options(${target_name} PRIVATE ${WERROR_FLAG})
# Take care of compiling BIFs.
if (FN_ARGS_BIFS)

View file

@ -1 +1 @@
6.2.0-dev.327
6.2.0-dev.337

@ -1 +1 @@
Subproject commit 867e90b47f657b92d03808af0475bfd34cc9bcef
Subproject commit 70d88f4b10e36f8715eb0f2a25eb0fc0eb4fce37

2
cmake

@ -1 +1 @@
Subproject commit 507d1201213a7b308298e0c5d6ac0c9f870e2bb8
Subproject commit 01fcb683005e3c3a71ae867aa983b772a77e32d1

4
configure vendored
View file

@ -64,6 +64,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--enable-perftools-debug use Google's perftools for debugging
--enable-static-binpac build binpac statically (ignored if --with-binpac is specified)
--enable-static-broker build Broker statically (ignored if --with-broker is specified)
--enable-werror build with -Werror
--disable-af-packet don't include native AF_PACKET support (Linux only)
--disable-archiver don't build or install zeek-archiver tool
--disable-auxtools don't build or install auxiliary tools
@ -275,6 +276,9 @@ while [ $# -ne 0 ]; do
--enable-static-broker)
append_cache_entry BUILD_STATIC_BROKER BOOL true
;;
--enable-werror)
append_cache_entry BUILD_WITH_WERROR BOOL true
;;
--disable-af-packet)
append_cache_entry DISABLE_AF_PACKET BOOL true
;;

@ -1 +1 @@
Subproject commit c2763e952ea899f86bec2b60f840d38861cefd03
Subproject commit 06d7496bfadf333e121409604eb55460f09cfcae

View file

@ -45,7 +45,10 @@ const char* attr_name(AttrTag t) {
};
// clang-format on
return attr_names[int(t)];
if ( int(t) >= 0 && int(t) < NUM_ATTRS )
return attr_names[int(t)];
else
return "<unknown>";
}
Attr::Attr(AttrTag t, ExprPtr e) : expr(std::move(e)) {

View file

@ -41,8 +41,16 @@ set(BISON_FLAGS "--debug")
if (MSVC)
set(SIGN_COMPARE_FLAG "/wd4018")
if (BUILD_WITH_WERROR)
# TODO: This is disabled for now because there a bunch of known
# compiler warnings on Windows that we don't have good fixes for.
#set(WERROR_FLAG "/WX")
endif ()
else ()
set(SIGN_COMPARE_FLAG "-Wno-sign-compare")
if (BUILD_WITH_WERROR)
set(WERROR_FLAG "-Werror")
endif ()
endif ()
# Rule parser/scanner
@ -517,6 +525,7 @@ collect_headers(zeek_HEADERS ${zeek_SRCS})
add_library(zeek_objs OBJECT ${zeek_SRCS})
target_compile_features(zeek_objs PRIVATE ${ZEEK_CXX_STD})
target_compile_options(zeek_objs PRIVATE ${WERROR_FLAG})
set_target_properties(zeek_objs PROPERTIES CXX_EXTENSIONS OFF)
target_link_libraries(zeek_objs PRIVATE $<BUILD_INTERFACE:zeek_internal>)
target_compile_definitions(zeek_objs PRIVATE ZEEK_CONFIG_SKIP_VERSION_H)
@ -530,6 +539,7 @@ endif ()
if (TARGET zeek_exe)
target_sources(zeek_exe PRIVATE main.cc ${zeek_HEADERS})
target_compile_options(zeek_exe PRIVATE ${WERROR_FLAG})
# npcap/winpcap need to be loaded in delayed mode so that we can set the load
# path correctly at runtime. See
@ -553,6 +563,7 @@ endif ()
if (TARGET zeek_lib)
target_sources(zeek_lib PRIVATE ${zeek_HEADERS})
target_compile_options(zeek_lib PRIVATE ${WERROR_FLAG})
target_link_libraries(zeek_lib PUBLIC ${zeekdeps} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
endif ()

View file

@ -6,7 +6,7 @@
#include <netdb.h>
#include <netinet/in.h>
#include <sys/poll.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>

View file

@ -47,9 +47,13 @@ void CPP_InitsInfo::GenerateInitializers(CPPCompile* c) {
if ( ++n > 1 )
c->Emit("");
c->Emit("{");
BuildCohort(c, cohort);
c->Emit("},");
if ( cohort.size() == 1 )
BuildCohort(c, cohort);
else {
c->Emit("{");
BuildCohort(c, cohort);
c->Emit("},");
}
}
c->Emit("}");

View file

@ -770,10 +770,9 @@ eval auto op1 = frame[z.v1].ToVal(z.t);
# the main instruction type, as always.
macro EvalVal2InTableCore(op1, op2)
ListVal lv(TYPE_ANY);
lv.Append(op1);
lv.Append(op2);
ListValPtr lvp = {NewRef{}, &lv};
auto lvp = zeek::make_intrusive<ListVal>(TYPE_ANY);
lvp->Append(op1);
lvp->Append(op2);
macro EvalVal2InTableAssignCore(slot)
frame[z.v1].int_val = frame[z.slot].table_val->Find(std::move(lvp)) != nullptr;

View file

@ -42,7 +42,7 @@ extern "C" {
#ifdef DEBUG
#define DBG_STEM(...) stem->LogDebug(__VA_ARGS__);
#else
#define DBG_STEM
#define DBG_STEM(...)
#endif
using namespace zeek;