Skip to content
Commits on Source (4)
---
Checks: '*,-cert-dcl21-cpp,-cert-err60-cpp,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-reinterpret-cast,-fuchsia-*,-google-runtime-references,-hicpp-no-array-decay,-readability-implicit-bool-conversion'
Checks: '*,-cert-dcl21-cpp,-cert-err60-cpp,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-reinterpret-cast,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-no-array-decay,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-magic-numbers'
#
# Disabled checks:
#
......@@ -9,6 +9,19 @@ Checks: '*,-cert-dcl21-cpp,-cert-err60-cpp,-cppcoreguidelines-pro-bounds-pointer
# cert-err60-cpp
# Reports std::runtime_error as broken which we can't do anything about.
#
# cppcoreguidelines-avoid-c-arrays
# hicpp-avoid-c-arrays
# modernize-avoid-c-arrays
# Makes sense for some array, but especially for char arrays using
# std::array isn't a good solution.
#
# cppcoreguidelines-avoid-magic-numbers
# readability-magic-numbers
# Good idea, but it goes too far to force this everywhere.
#
# cppcoreguidelines-macro-usage
# There are cases where macros are simply needed.
#
# cppcoreguidelines-pro-bounds-array-to-pointer-decay
# Limited use and many false positives including for all asserts.
#
......@@ -28,6 +41,9 @@ Checks: '*,-cert-dcl21-cpp,-cert-err60-cpp,-cppcoreguidelines-pro-bounds-pointer
# hicpp-no-array-decay
# Limited use and many false positives including for all asserts.
#
# modernize-use-trailing-return-type
# We are not quite that modern.
#
# readability-implicit-bool-conversion
# Not necessarily more readable.
#
......
......@@ -33,7 +33,10 @@ addons_shortcuts:
addons_clang60: &clang60
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libprotobuf-dev','protobuf-compiler', 'clang-6.0', 'clang-tidy-6.0' ]
packages: [ 'libprotobuf-dev','protobuf-compiler', 'clang-6.0' ]
addons_clang7: &clang7
apt:
packages: [ 'libprotobuf-dev','protobuf-compiler', 'clang-7', 'clang-tidy-7' ]
addons_gcc47: &gcc47
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
......@@ -56,8 +59,15 @@ addons_shortcuts:
packages: [ 'libprotobuf-dev','protobuf-compiler', 'g++-6', 'gcc-6' ]
addons_gcc7: &gcc7
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libprotobuf-dev','protobuf-compiler', 'g++-7', 'gcc-7' ]
packages: [ 'libprotobuf-dev','protobuf-compiler' ]
#-----------------------------------------------------------------------------
addons:
homebrew:
packages:
- protobuf
update: true
#-----------------------------------------------------------------------------
......@@ -92,20 +102,28 @@ matrix:
- os: linux
compiler: "clang-6.0"
env: BUILD='Debug' CC=clang-6.0 CXX=clang++-6.0
CLANG_TIDY=clang-tidy-6.0
addons: *clang60
- os: linux
compiler: "clang-6.0"
env: BUILD='Debug' CC=clang-6.0 CXX=clang++-6.0
compiler: "clang-7"
env: BUILD='Debug' CC=clang-7 CXX=clang++-7
CLANG_TIDY=clang-tidy-7
dist: bionic
addons: *clang7
- os: linux
compiler: "clang-7"
env: BUILD='Debug' CC=clang-7 CXX=clang++-7
CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
LDFLAGS="-fsanitize=address,undefined,integer"
addons: *clang60
dist: bionic
addons: *clang7
- os: linux
compiler: "clang-6.0"
env: BUILD='Release' CC=clang-6.0 CXX=clang++-6.0
addons: *clang60
compiler: "clang-7"
env: BUILD='Release' CC=clang-7 CXX=clang++-7
dist: bionic
addons: *clang7
- os: linux
compiler: "gcc-4.7"
......@@ -148,17 +166,20 @@ matrix:
env: BUILD='Debug' CC=gcc-7 CXX=g++-7
COVERAGE=gcov-7
CXXFLAGS="--coverage" LDFLAGS="--coverage"
dist: bionic
addons: *gcc7
- os: linux
compiler: "gcc-7"
env: BUILD='Debug' CC=gcc-7 CXX=g++-7
PROTOZERO_DATA_VIEW=std::experimental::string_view
dist: bionic
addons: *gcc7
- os: linux
compiler: "gcc-7"
env: BUILD='Release' CC=gcc-7 CXX=g++-7
dist: bionic
addons: *gcc7
- os: osx
......@@ -172,25 +193,22 @@ matrix:
env: BUILD='Debug'
- os: osx
osx_image: xcode10.1
osx_image: xcode10.2
compiler: clang
env: BUILD='Debug'
- os: osx
osx_image: xcode10.1
osx_image: xcode11
compiler: clang
env: BUILD='Debug'
- os: osx
osx_image: xcode11
compiler: clang
env: BUILD='Release'
#-----------------------------------------------------------------------------
install:
- |
if [[ $(uname -s) == 'Darwin' ]]; then
brew update
brew install protobuf
true
fi
script:
- mkdir build
- cd build
......
......@@ -15,6 +15,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
## [1.6.8] - 2019-08-15
### Changed
- Various code cleanups due to clang-tidy warnings.
### Fixed
- Made `data_view::compare` noexcept.
## [1.6.7] - 2018-02-21
### Fixed
......@@ -353,8 +364,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Make pbf reader and writer code endianess-aware.
[unreleased]: https://github.com/osmcode/libosmium/compare/v1.6.6...HEAD
[1.6.5]: https://github.com/osmcode/libosmium/compare/v1.6.5...v1.6.6
[unreleased]: https://github.com/osmcode/libosmium/compare/v1.6.8...HEAD
[1.6.8]: https://github.com/osmcode/libosmium/compare/v1.6.7...v1.6.8
[1.6.7]: https://github.com/osmcode/libosmium/compare/v1.6.6...v1.6.7
[1.6.6]: https://github.com/osmcode/libosmium/compare/v1.6.5...v1.6.6
[1.6.5]: https://github.com/osmcode/libosmium/compare/v1.6.4...v1.6.5
[1.6.4]: https://github.com/osmcode/libosmium/compare/v1.6.3...v1.6.4
[1.6.3]: https://github.com/osmcode/libosmium/compare/v1.6.2...v1.6.3
......
......@@ -14,7 +14,7 @@ project(protozero)
set(PROTOZERO_VERSION_MAJOR 1)
set(PROTOZERO_VERSION_MINOR 6)
set(PROTOZERO_VERSION_PATCH 7)
set(PROTOZERO_VERSION_PATCH 8)
set(PROTOZERO_VERSION
"${PROTOZERO_VERSION_MAJOR}.${PROTOZERO_VERSION_MINOR}.${PROTOZERO_VERSION_PATCH}")
......@@ -58,7 +58,7 @@ find_package(Protobuf)
#
#-----------------------------------------------------------------------------
message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-6.0 clang-tidy-5.0)
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7 clang-tidy-6.0 clang-tidy-5.0)
if(CLANG_TIDY)
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
......
protozero (1.6.7-2) UNRELEASED; urgency=medium
protozero (1.6.8-1) unstable; urgency=medium
* New upstream release.
* Update gbp.conf to use --source-only-changes by default.
* Bump Standards-Version to 4.4.0, no changes.
-- Bas Couwenberg <sebastic@debian.org> Sun, 07 Jul 2019 09:36:02 +0200
-- Bas Couwenberg <sebastic@debian.org> Thu, 15 Aug 2019 15:26:03 +0200
protozero (1.6.7-1) unstable; urgency=medium
......
......@@ -27,10 +27,10 @@ inline uint32_t byteswap_impl(uint32_t value) noexcept {
#ifdef PROTOZERO_USE_BUILTIN_BSWAP
return __builtin_bswap32(value);
#else
return ((value & 0xff000000) >> 24) |
((value & 0x00ff0000) >> 8) |
((value & 0x0000ff00) << 8) |
((value & 0x000000ff) << 24);
return ((value & 0xff000000U) >> 24U) |
((value & 0x00ff0000U) >> 8U) |
((value & 0x0000ff00U) << 8U) |
((value & 0x000000ffU) << 24U);
#endif
}
......@@ -38,14 +38,14 @@ inline uint64_t byteswap_impl(uint64_t value) noexcept {
#ifdef PROTOZERO_USE_BUILTIN_BSWAP
return __builtin_bswap64(value);
#else
return ((value & 0xff00000000000000ULL) >> 56) |
((value & 0x00ff000000000000ULL) >> 40) |
((value & 0x0000ff0000000000ULL) >> 24) |
((value & 0x000000ff00000000ULL) >> 8) |
((value & 0x00000000ff000000ULL) << 8) |
((value & 0x0000000000ff0000ULL) << 24) |
((value & 0x000000000000ff00ULL) << 40) |
((value & 0x00000000000000ffULL) << 56);
return ((value & 0xff00000000000000ULL) >> 56U) |
((value & 0x00ff000000000000ULL) >> 40U) |
((value & 0x0000ff0000000000ULL) >> 24U) |
((value & 0x000000ff00000000ULL) >> 8U) |
((value & 0x00000000ff000000ULL) << 8U) |
((value & 0x0000000000ff0000ULL) << 24U) |
((value & 0x000000000000ff00ULL) << 40U) |
((value & 0x00000000000000ffULL) << 56U);
#endif
}
......
......@@ -141,8 +141,8 @@ public:
*
* @pre Must not be default constructed data_view.
*/
int compare(data_view other) const {
protozero_assert(m_data && other.m_data);
int compare(data_view other) const noexcept {
assert(m_data && other.m_data);
const int cmp = std::memcmp(data(), other.data(),
std::min(size(), other.size()));
if (cmp == 0) {
......
......@@ -291,10 +291,10 @@ class const_varint_iterator {
protected:
/// Pointer to current iterator position
const char* m_data = nullptr;
const char* m_data = nullptr; // NOLINT(misc-non-private-member-variables-in-classes, cppcoreguidelines-non-private-member-variables-in-classes,-warnings-as-errors)
/// Pointer to end iterator position
const char* m_end = nullptr;
const char* m_end = nullptr; // NOLINT(misc-non-private-member-variables-in-classes, cppcoreguidelines-non-private-member-variables-in-classes,-warnings-as-errors)
public:
......@@ -316,7 +316,7 @@ public:
// significant bit not set. We can use this to quickly figure out
// how many varints there are without actually decoding the varints.
return std::count_if(begin.m_data, end.m_data, [](char c) noexcept {
return (static_cast<unsigned char>(c) & 0x80u) == 0;
return (static_cast<unsigned char>(c) & 0x80U) == 0;
});
}
......
......@@ -287,7 +287,7 @@ public:
}
const auto value = get_varint<uint32_t>();
m_tag = pbf_tag_type(value >> 3u);
m_tag = pbf_tag_type(value >> 3U);
// tags 0 and 19000 to 19999 are not allowed as per
// https://developers.google.com/protocol-buffers/docs/proto#assigning-tags
......@@ -295,7 +295,7 @@ public:
throw invalid_tag_exception{};
}
m_wire_type = pbf_wire_type(value & 0x07u);
m_wire_type = pbf_wire_type(value & 0x07U);
switch (m_wire_type) {
case pbf_wire_type::varint:
case pbf_wire_type::fixed64:
......
......@@ -78,8 +78,8 @@ class pbf_writer {
}
void add_field(pbf_tag_type tag, pbf_wire_type type) {
protozero_assert(((tag > 0 && tag < 19000) || (tag > 19999 && tag <= ((1u << 29u) - 1))) && "tag out of range");
const uint32_t b = (tag << 3u) | uint32_t(type);
protozero_assert(((tag > 0 && tag < 19000) || (tag > 19999 && tag <= ((1U << 29U) - 1))) && "tag out of range");
const uint32_t b = (tag << 3U) | uint32_t(type);
add_varint(b);
}
......@@ -289,9 +289,16 @@ public:
return *this;
}
~pbf_writer() {
if (m_parent_writer != nullptr) {
m_parent_writer->close_submessage();
~pbf_writer() noexcept {
try {
if (m_parent_writer != nullptr) {
m_parent_writer->close_submessage();
}
} catch (...) {
// This try/catch is used to make the destructor formally noexcept.
// close_submessage() is not noexcept, but will not throw the way
// it is called here, so we are good. But to be paranoid, call...
std::terminate();
}
}
......@@ -928,7 +935,7 @@ namespace detail {
protected:
pbf_writer m_writer{};
pbf_writer m_writer{}; // NOLINT(misc-non-private-member-variables-in-classes, cppcoreguidelines-non-private-member-variables-in-classes,-warnings-as-errors)
public:
......
......@@ -53,7 +53,7 @@ enum class pbf_wire_type : uint32_t {
*/
template <typename T>
constexpr inline uint32_t tag_and_type(T tag, pbf_wire_type wire_type) noexcept {
return (static_cast<uint32_t>(static_cast<pbf_tag_type>(tag)) << 3u) | static_cast<uint32_t>(wire_type);
return (static_cast<uint32_t>(static_cast<pbf_tag_type>(tag)) << 3U) | static_cast<uint32_t>(wire_type);
}
/**
......
......@@ -39,22 +39,22 @@ namespace detail {
if (iend - begin >= max_varint_length) { // fast path
do {
int64_t b;
b = *p++; val = ((uint64_t(b) & 0x7fu) ); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 7u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 14u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 21u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 28u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 35u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 42u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 49u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fu) << 56u); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x01u) << 63u); if (b >= 0) { break; }
b = *p++; val = ((uint64_t(b) & 0x7fU) ); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 7U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 14U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 21U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 28U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 35U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 42U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 49U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x7fU) << 56U); if (b >= 0) { break; }
b = *p++; val |= ((uint64_t(b) & 0x01U) << 63U); if (b >= 0) { break; }
throw varint_too_long_exception{};
} while (false);
} else {
unsigned int shift = 0;
while (p != iend && *p < 0) {
val |= (uint64_t(*p++) & 0x7fu) << shift;
val |= (uint64_t(*p++) & 0x7fU) << shift;
shift += 7;
}
if (p == iend) {
......@@ -88,7 +88,7 @@ namespace detail {
*/
inline uint64_t decode_varint(const char** data, const char* end) {
// If this is a one-byte varint, decode it here.
if (end != *data && ((static_cast<uint64_t>(**data) & 0x80u) == 0)) {
if (end != *data && ((static_cast<uint64_t>(**data) & 0x80U) == 0)) {
const auto val = static_cast<uint64_t>(**data);
++(*data);
return val;
......@@ -145,9 +145,9 @@ template <typename T>
inline int write_varint(T data, uint64_t value) {
int n = 1;
while (value >= 0x80u) {
*data++ = char((value & 0x7fu) | 0x80u);
value >>= 7u;
while (value >= 0x80U) {
*data++ = char((value & 0x7fU) | 0x80U);
value >>= 7U;
++n;
}
*data++ = char(value);
......@@ -164,8 +164,8 @@ inline int write_varint(T data, uint64_t value) {
inline int length_of_varint(uint64_t value) noexcept {
int n = 1;
while (value >= 0x80u) {
value >>= 7u;
while (value >= 0x80U) {
value >>= 7U;
++n;
}
......@@ -176,28 +176,28 @@ inline int length_of_varint(uint64_t value) noexcept {
* ZigZag encodes a 32 bit integer.
*/
inline constexpr uint32_t encode_zigzag32(int32_t value) noexcept {
return (static_cast<uint32_t>(value) << 1u) ^ static_cast<uint32_t>(-static_cast<int32_t>(static_cast<uint32_t>(value) >> 31u));
return (static_cast<uint32_t>(value) << 1U) ^ static_cast<uint32_t>(-static_cast<int32_t>(static_cast<uint32_t>(value) >> 31U));
}
/**
* ZigZag encodes a 64 bit integer.
*/
inline constexpr uint64_t encode_zigzag64(int64_t value) noexcept {
return (static_cast<uint64_t>(value) << 1u) ^ static_cast<uint64_t>(-static_cast<int64_t>(static_cast<uint64_t>(value) >> 63u));
return (static_cast<uint64_t>(value) << 1U) ^ static_cast<uint64_t>(-static_cast<int64_t>(static_cast<uint64_t>(value) >> 63U));
}
/**
* Decodes a 32 bit ZigZag-encoded integer.
*/
inline constexpr int32_t decode_zigzag32(uint32_t value) noexcept {
return static_cast<int32_t>((value >> 1u) ^ static_cast<uint32_t>(-static_cast<int32_t>(value & 1u)));
return static_cast<int32_t>((value >> 1U) ^ static_cast<uint32_t>(-static_cast<int32_t>(value & 1U)));
}
/**
* Decodes a 64 bit ZigZag-encoded integer.
*/
inline constexpr int64_t decode_zigzag64(uint64_t value) noexcept {
return static_cast<int64_t>((value >> 1u) ^ static_cast<uint64_t>(-static_cast<int64_t>(value & 1u)));
return static_cast<int64_t>((value >> 1U) ^ static_cast<uint64_t>(-static_cast<int64_t>(value & 1U)));
}
} // end namespace protozero
......
......@@ -23,12 +23,12 @@ documentation.
#define PROTOZERO_VERSION_MINOR 6
/// The patch number
#define PROTOZERO_VERSION_PATCH 7
#define PROTOZERO_VERSION_PATCH 8
/// The complete version number
#define PROTOZERO_VERSION_CODE (PROTOZERO_VERSION_MAJOR * 10000 + PROTOZERO_VERSION_MINOR * 100 + PROTOZERO_VERSION_PATCH)
/// Version number as string
#define PROTOZERO_VERSION_STRING "1.6.7"
#define PROTOZERO_VERSION_STRING "1.6.8"
#endif // PROTOZERO_VERSION_HPP
// NOLINT(llvm-header-guard)
#include <array>
#define PBF_TYPE_NAME PROTOZERO_TEST_STRING(PBF_TYPE)
#define GET_TYPE PROTOZERO_TEST_CONCAT(get_packed_, PBF_TYPE)
#define ADD_TYPE PROTOZERO_TEST_CONCAT(add_packed_, PBF_TYPE)
......@@ -105,21 +107,27 @@ TEST_CASE("write repeated packed field: " PBF_TYPE_NAME) {
protozero::pbf_writer pw{buffer};
SECTION("empty") {
cpp_type data[] = { 17 };
std::array<cpp_type, 1> data = {{ 17 }};
pw.ADD_TYPE(1, std::begin(data), std::begin(data) /* !!!! */);
REQUIRE(buffer == load_data("repeated_packed_" PBF_TYPE_NAME "/data-empty"));
}
SECTION("one") {
cpp_type data[] = { 17 };
std::array<cpp_type, 1> data = {{ 17 }};
pw.ADD_TYPE(1, std::begin(data), std::end(data));
REQUIRE(buffer == load_data("repeated_packed_" PBF_TYPE_NAME "/data-one"));
}
SECTION("many") {
cpp_type data[] = {
std::array<cpp_type,
#if PBF_TYPE_IS_SIGNED
8
#else
5
#endif
> data = {{
17
, 200
, 0
......@@ -130,7 +138,7 @@ TEST_CASE("write repeated packed field: " PBF_TYPE_NAME) {
, -1
,std::numeric_limits<cpp_type>::min()
#endif
};
}};
pw.ADD_TYPE(1, std::begin(data), std::end(data));
REQUIRE(buffer == load_data("repeated_packed_" PBF_TYPE_NAME "/data-many"));
......@@ -246,9 +254,9 @@ TEST_CASE("write from different types of iterators: " PBF_TYPE_NAME) {
SECTION("from uint16_t") {
#if PBF_TYPE_IS_SIGNED
const int16_t data[] = { 1, 4, 9, 16, 25 };
const std::array< int16_t, 5> data = {{ 1, 4, 9, 16, 25 }};
#else
const uint16_t data[] = { 1, 4, 9, 16, 25 };
const std::array<uint16_t, 5> data = {{ 1, 4, 9, 16, 25 }};
#endif
pw.ADD_TYPE(1, std::begin(data), std::end(data));
......
......@@ -126,7 +126,7 @@ TEST_CASE("write bool field using moved pbf_builder") {
protozero::pbf_builder<TestBoolean::Test> pw{std::move(pw2)};
REQUIRE(pw.valid());
REQUIRE_FALSE(pw2.valid()); // NOLINT(hicpp-invalid-access-moved, bugprone-use-after-move)
REQUIRE_FALSE(pw2.valid()); // NOLINT(hicpp-invalid-access-moved, bugprone-use-after-move, clang-analyzer-cplusplus.Move)
SECTION("false") {
pw.add_bool(TestBoolean::Test::required_bool_b, false);
......
#include <testcase.hpp>
#include "testcase.pb.h"
int main(int c, char *argv[]) {
int main() {
TestBoolean::Test msg;
msg.set_b(0);
......
#include <testcase.hpp>
#include "testcase.pb.h"
int main(int c, char *argv[]) {
int main() {
TestBytes::Test msg;
msg.set_s("");
......
#include <test.hpp>
#include <array>
namespace TestComplex {
enum class Test : protozero::pbf_tag_type {
......@@ -416,7 +418,7 @@ TEST_CASE("write complex data using pbf_writer: all") {
pw.add_uint32(4, 66);
pw.add_uint32(4, 66);
const int32_t d[] = { -17, 22 };
const std::array<int32_t, 2> d = {{ -17, 22 }};
pw.add_packed_sint32(7, std::begin(d), std::end(d));
pw.add_int64(3, 555555555);
......@@ -573,7 +575,7 @@ TEST_CASE("write complex data using pbf_builder: all") {
pw.add_uint32(TestComplex::Test::repeated_uint32_u, 66);
pw.add_uint32(TestComplex::Test::repeated_uint32_u, 66);
const int32_t d[] = { -17, 22 };
const std::array<int32_t, 2> d = {{ -17, 22 }};
pw.add_packed_sint32(TestComplex::Test::packed_sint32_d, std::begin(d), std::end(d));
pw.add_int64(TestComplex::Test::optional_int64_j, 555555555);
......
#include <testcase.hpp>
#include "testcase.pb.h"
int main(int c, char *argv[]) {
int main() {
TestComplex::Test msg;
msg.set_f(12345678);
......
#include <testcase.hpp>
#include "testcase.pb.h"
int main(int c, char *argv[]) {
int main() {
TestDouble::Test msg;
msg.set_x(0.0);
......