Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions ci/rat-regex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ port\.h
^override.css$
^catch[.]hpp$
^configuru.hpp$
^Catch2$
^yamlcpp$
^systemtap$
^swoc$
Expand Down
2 changes: 1 addition & 1 deletion include/tscore/ink_inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ struct IpAddr {
///< Pre-constructed invalid instance.
static self const INVALID;

operator swoc::IPAddr()
operator swoc::IPAddr() const
{
switch (_family) {
case AF_INET:
Expand Down
38 changes: 35 additions & 3 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,41 @@
add_compile_options(-Wno-shadow)
set(BUILD_SHARED_LIBS 1)

if(BUILD_TESTING)
# Currently v3.9.1. To update:
# cd <git-clone-root>/lib
# rm -rf Catch2
# git clone https://github.com/catchorg/Catch2.git
# cd Catch2
# git checkout <desired-version>
# rm -rf .git data examples docs fuzzing tests tools .bazelrc .conan .github
# cd ..
# git add Catch2
#
# Update the above comment about the version to update.
add_subdirectory(Catch2)

# Disable -Werror=parentheses for Catch2 to avoid issues with older compilers (GCC <=11)
# that complain about the use of parentheses in macro expansions. We see errors like this:
#
# catch_test_macro_impl.hpp:50:67: error: suggest parentheses around comparison in operand of '==' [-Werror=parentheses]
# ...
# 297 | CHECK(fut1.get() == expected1);
# | ^~~~~
target_compile_options(Catch2 INTERFACE -Wno-error=parentheses)
target_compile_options(Catch2WithMain INTERFACE -Wno-error=parentheses)

# By default, as of v3.9.0, Catch2 runs tests in random order. Our tests are
# written with the expectation that they are run in declared order, with setup
# done in one TEST_CASE expected to carry over into the next TEST_CASE. This
# macro allows us to add common command line arguments to all tests. For now,
# we ensure declaration order execution via --order decl.
macro(add_catch2_test)
cmake_parse_arguments(CATCH2_TEST "" "NAME" "COMMAND" ${ARGN})
add_test(NAME ${CATCH2_TEST_NAME} COMMAND ${CATCH2_TEST_COMMAND} --order decl)
endmacro()
endif()

if(NOT TARGET yaml-cpp::yaml-cpp)
# Turning CLANG_FORMAT off causes yamlcpp to not add its format target which
# otherwise conflicts with our format target.
Expand All @@ -39,9 +74,6 @@ if(NOT EXTERNAL_LIBSWOC)
)
endif()

add_library(catch2::catch2 INTERFACE IMPORTED GLOBAL)
target_include_directories(catch2::catch2 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/catch2")

add_library(systemtap::systemtap INTERFACE IMPORTED GLOBAL)
target_include_directories(systemtap::systemtap INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/systemtap")

Expand Down
45 changes: 45 additions & 0 deletions lib/Catch2/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
Language: Cpp
Standard: c++14

# Note that we cannot use IncludeIsMainRegex functionality, because it
# does not support includes in angle brackets (<>)
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: <catch2/.*\.hpp>
Priority: 1
- Regex: <.*/.*\.hpp>
Priority: 2
- Regex: <.*>
Priority: 3

AllowShortBlocksOnASingleLine: Always
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: Inline

AccessModifierOffset: "-4"
AlignEscapedNewlines: Left
AllowAllConstructorInitializersOnNextLine: "true"
BinPackArguments: "false"
BinPackParameters: "false"
BreakConstructorInitializers: AfterColon
ConstructorInitializerAllOnOneLineOrOnePerLine: "true"
DerivePointerAlignment: "false"
FixNamespaceComments: "true"
IndentCaseLabels: "false"
IndentPPDirectives: AfterHash
IndentWidth: "4"
NamespaceIndentation: All
PointerAlignment: Left
SpaceBeforeCtorInitializerColon: "false"
SpaceInEmptyParentheses: "false"
SpacesInParentheses: "true"
TabWidth: "4"
UseTab: Never
AlwaysBreakTemplateDeclarations: Yes
SpaceAfterTemplateKeyword: true
SortUsingDeclarations: true
ReflowComments: true
82 changes: 82 additions & 0 deletions lib/Catch2/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# Note: Alas, `Checks` is a string, not an array.
# Comments in the block string are not parsed and are passed in the value.
# They must thus be delimited by ',' from either side - then they are
# harmless. It's terrible, but it works.
Checks: >-
clang-diagnostic-*,
clang-analyzer-*,
-clang-analyzer-optin.core.EnumCastOutOfRange,

bugprone-*,
-bugprone-unchecked-optional-access,
,# This is ridiculous, as it triggers on constants,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-easily-swappable-parameters,
,# Is not really useful, has false positives, triggers for no-noexcept move constructors ...,
-bugprone-exception-escape,
-bugprone-narrowing-conversions,
-bugprone-chained-comparison,# RIP decomposers,

modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-auto,
-modernize-use-emplace,
-modernize-use-nullptr,# it went crazy with three-way comparison operators,
-modernize-use-trailing-return-type,
-modernize-return-braced-init-list,
-modernize-concat-nested-namespaces,
-modernize-use-nodiscard,
-modernize-use-default-member-init,
-modernize-type-traits,# we need to support C++14,
-modernize-deprecated-headers,
,# There's a lot of these and most of them are probably not useful,
-modernize-pass-by-value,

performance-*,
performance-enum-size,

portability-*,

readability-*,
-readability-braces-around-statements,
-readability-container-size-empty,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-math-missing-parentheses, #no, 'a + B * C' obeying math rules is not confusing,
-readability-named-parameter,
-readability-qualified-auto,
-readability-redundant-access-specifiers,
-readability-simplify-boolean-expr,
-readability-static-definition-in-anonymous-namespace,
-readability-uppercase-literal-suffix,
-readability-use-anyofallof,
-readability-avoid-return-with-void-value,

,# time hogs,
-bugprone-throw-keyword-missing,
-modernize-replace-auto-ptr,
-readability-identifier-naming,

,# We cannot use this until clang-tidy supports custom unique_ptr,
-bugprone-use-after-move,
,# Doesn't recognize unevaluated context in CATCH_MOVE and CATCH_FORWARD,
-bugprone-macro-repeated-side-effects,
WarningsAsErrors: >-
clang-analyzer-core.*,
clang-analyzer-cplusplus.*,
clang-analyzer-security.*,
clang-analyzer-unix.*,
performance-move-const-arg,
performance-unnecessary-value-param,
readability-duplicate-include,
HeaderFilterRegex: '.*\.(c|cxx|cpp)$'
FormatStyle: none
CheckOptions: {}
...
22 changes: 22 additions & 0 deletions lib/Catch2/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This sets the default behaviour, overriding core.autocrlf
* text=auto

# All source files should have unix line-endings in the repository,
# but convert to native line-endings on checkout
*.cpp text
*.h text
*.hpp text

# Windows specific files should retain windows line-endings
*.sln text eol=crlf

# Keep executable scripts with LFs so they can be run after being
# checked out on Windows
*.py text eol=lf


# Keep the single include header with LFs to make sure it is uploaded,
# hashed etc with LF
single_include/**/*.hpp eol=lf
# Also keep the LICENCE file with LFs for the same reason
LICENCE.txt eol=lf
40 changes: 40 additions & 0 deletions lib/Catch2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
*.build
!meson.build
*.pbxuser
*.mode1v3
*.ncb
*.suo
Debug
Release
*.user
*.xcuserstate
.DS_Store
xcuserdata
CatchSelfTest.xcscheme
Breakpoints.xcbkptlist
UpgradeLog.XML
Resources/DWARF
projects/Generated
*.pyc
DerivedData
*.xccheckout
Build
.idea
.vs
.vscode
cmake-build-*
benchmark-dir
.conan/test_package/build
**/CMakeUserPresets.json
bazel-*
MODULE.bazel.lock
build-fuzzers
debug-build
.vscode
msvc-sln*
# Currently we use Doxygen for dep graphs and the full docs are only slowly
# being filled in, so we definitely do not want git to deal with the docs.
docs/doxygen
*.cache
compile_commands.json
**/*.unapproved.txt
117 changes: 117 additions & 0 deletions lib/Catch2/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_license//rules:license.bzl", "license")

package(
default_applicable_licenses = [":license"],
)

exports_files([
"LICENSE.MIT",
])

license(
name = "license",
license_kinds = ["@rules_license//licenses/spdx:BSL-1.0"],
license_text = "LICENSE.MIT",
)

expand_template(
name = "catch_user_config",
out = "catch2/catch_user_config.hpp",
substitutions = {
"@CATCH_CONFIG_CONSOLE_WIDTH@": "80",
"@CATCH_CONFIG_DEFAULT_REPORTER@": "console",
"#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE": "",
"#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT": "#define CATCH_CONFIG_BAZEL_SUPPORT",
"#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "",
"#cmakedefine CATCH_CONFIG_COUNTER": "",
"#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "",
"#cmakedefine CATCH_CONFIG_CPP17_BYTE": "",
"#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL": "",
"#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "",
"#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "",
"#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "",
"#cmakedefine CATCH_CONFIG_DEPRECATION_ANNOTATIONS": "",
"#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "",
"#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "",
"#cmakedefine CATCH_CONFIG_DISABLE_STRINGIFICATION": "",
"#cmakedefine CATCH_CONFIG_DISABLE": "",
"#cmakedefine CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS": "",
"#cmakedefine CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER": "",
"#cmakedefine CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER": "",
"#cmakedefine CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER": "",
"#cmakedefine CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER": "",
"#cmakedefine CATCH_CONFIG_EXPERIMENTAL_REDIRECT": "",
"#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@": "",
"#cmakedefine CATCH_CONFIG_FAST_COMPILE": "",
"#cmakedefine CATCH_CONFIG_GETENV": "",
"#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER": "",
"#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE": "",
"#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "",
"#cmakedefine CATCH_CONFIG_NO_COUNTER": "",
"#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "",
"#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "",
"#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL": "",
"#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "",
"#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "",
"#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "",
"#cmakedefine CATCH_CONFIG_NO_DEPRECATION_ANNOTATIONS": "",
"#cmakedefine CATCH_CONFIG_NO_GETENV": "",
"#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "",
"#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS": "",
"#cmakedefine CATCH_CONFIG_NO_USE_ASYNC": "",
"#cmakedefine CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT": "",
"#cmakedefine CATCH_CONFIG_NO_WCHAR": "",
"#cmakedefine CATCH_CONFIG_NO_WINDOWS_SEH": "",
"#cmakedefine CATCH_CONFIG_NOSTDOUT": "",
"#cmakedefine CATCH_CONFIG_POSIX_SIGNALS": "",
"#cmakedefine CATCH_CONFIG_PREFIX_ALL": "",
"#cmakedefine CATCH_CONFIG_PREFIX_MESSAGES": "",
"#cmakedefine CATCH_CONFIG_SHARED_LIBRARY": "",
"#cmakedefine CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT": "",
"#cmakedefine CATCH_CONFIG_USE_ASYNC": "",
"#cmakedefine CATCH_CONFIG_WCHAR": "",
"#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG": "",
"#cmakedefine CATCH_CONFIG_WINDOWS_SEH": "",
"#cmakedefine CATCH_CONFIG_USE_BUILTIN_CONSTANT_P": "",
"#cmakedefine CATCH_CONFIG_NO_USE_BUILTIN_CONSTANT_P": "",
"#cmakedefine CATCH_CONFIG_EXPERIMENTAL_THREAD_SAFE_ASSERTIONS": "",
"#cmakedefine CATCH_CONFIG_NO_EXPERIMENTAL_THREAD_SAFE_ASSERTIONS": "",
},
template = "src/catch2/catch_user_config.hpp.in",
)

# Generated header library, modifies the include prefix to account for
# generation path so that we can include <catch2/catch_user_config.hpp>
# correctly.
cc_library(
name = "catch2_generated",
hdrs = ["catch2/catch_user_config.hpp"],
include_prefix = ".", # to manipulate -I of dependencies
visibility = ["//visibility:public"],
)

# Static library, without main.
cc_library(
name = "catch2",
srcs = glob(
["src/catch2/**/*.cpp"],
exclude = ["src/catch2/internal/catch_main.cpp"],
),
hdrs = glob(["src/catch2/**/*.hpp"]),
includes = ["src/"],
linkstatic = True,
visibility = ["//visibility:public"],
deps = [":catch2_generated"],
)

# Static library, with main.
cc_library(
name = "catch2_main",
srcs = ["src/catch2/internal/catch_main.cpp"],
includes = ["src/"],
linkstatic = True,
visibility = ["//visibility:public"],
deps = [":catch2"],
)
9 changes: 9 additions & 0 deletions lib/Catch2/CMake/Catch2Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@

# Avoid repeatedly including the targets
if(NOT TARGET Catch2::Catch2)
# Provide path for scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake)
endif()
Loading