727 Commits

Author SHA1 Message Date
Robert Edmonds
e05528c871
Merge pull request #718 from protobuf-c/edmonds/ci/fail-fast-false
build.yml: Set "fail-fast: false" so we can tell which jobs are failing
2024-04-27 22:29:00 -04:00
Robert Edmonds
4b3e198d07 build.yml: Set "fail-fast: false" so we can tell which jobs are failing 2024-04-27 22:10:25 -04:00
Robert Edmonds
8d36a9d0b0
Merge pull request #717 from protobuf-c/edmonds/ci/macos-install-libtool
build.yml: Install libtool on OS X
2024-04-27 22:09:04 -04:00
Robert Edmonds
c8258be919 build.yml: Install libtool on OS X
This might fix the new CI build failure:

    → Run ./autogen.sh
    autoreconf: export WARNINGS=
    autoreconf: Entering directory '.'
    autoreconf: configure.ac: not using Gettext
    autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
    autoreconf: configure.ac: tracing
    autoreconf: configure.ac: creating directory build-aux
    autoreconf: configure.ac: not using Libtool
    autoreconf: configure.ac: not using Intltool
    autoreconf: configure.ac: not using Gtkdoc
    autoreconf: running: /opt/homebrew/Cellar/autoconf/2.72/bin/autoconf --force
    autoreconf: running: /opt/homebrew/Cellar/autoconf/2.72/bin/autoheader --force
    autoreconf: running: automake --add-missing --copy --force-missing
    configure.ac:14: installing 'build-aux/compile'
    configure.ac:13: installing 'build-aux/install-sh'
    configure.ac:13: installing 'build-aux/missing'
    Makefile.am:4: error: Libtool library used but 'LIBTOOL' is undefined
    Makefile.am:4:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
    Makefile.am:4:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
    Makefile.am:4:   If 'LT_INIT' is in 'configure.ac', make sure
    Makefile.am:4:   its definition is in aclocal's search path.
    Makefile.am: installing 'build-aux/depcomp'
    parallel-tests: installing 'build-aux/test-driver'
    autoreconf: error: automake failed with exit status: 1
2024-04-27 21:55:55 -04:00
Robert Edmonds
0b629e68fe
Merge pull request #714 from clementperon/fix_cmake
Fix CI issues with CMake
2024-04-27 21:15:35 -04:00
Clément Péron
af0ea6fac8 cmake: link with target to also get include directory
cxx-generate-packed-data needs to link with protobuf library for the C++
source file.

Use the protobuf::libprotobuf to get both library and include directory.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-22 09:58:56 +02:00
Clément Péron
49966f6c84 cmake: keep compatibility with CMake FindProtobuf module
PROTOBUF_PROTOC_EXECUTABLE is not set in the Protobuf CMake config file.
Set it properly in case we use CMake protobuf config file.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-22 09:58:56 +02:00
Clément Péron
1c954558f1 cmake: fix warning about policy CMP0145
Keep the DART compatibility enabled until test are moved
to CTest.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-22 09:58:56 +02:00
Clément Péron
05f9112acd ci: build: always update cache to avoid out of date packages
APT cache could be out of date leading to a:
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Fix this by always calling apt-get update before an apt-get install.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-21 14:57:31 +02:00
Clément Péron
be2c33276b cmake: fix recent protobuf build with cmake
The CMake module is used by default but isn't compatible with
recent protobuf version.

Try to first look for a protobuf config then fallback to legacy
cmake module.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-21 14:57:31 +02:00
Robert Edmonds
5c13d7dfe9
Merge pull request #703 from smuellerDD/fix_corruption
protobuf_c_message_unpack(): Fix memory corruption by initializing unknown_fields pointer
2024-03-21 03:30:39 +00:00
Diego Elio Pettenò
7765485b6b Update link to Autotools Mythbuster.
The canonical doman is no longer dot-io, though both work.
2024-03-20 23:25:03 -04:00
Robert Edmonds
6bafe333f8
Merge pull request #700 from AlessandroBono/wip/abono/config-cmake-in
Makefile.am: Distribute missing Config.cmake.in
2024-03-21 03:21:08 +00:00
Robert Edmonds
8b3207c4e6
Merge pull request #699 from AlessandroBono/wip/abono/double-hyphens
CMakeLists.txt: Remove double hyphens
2024-03-21 03:19:02 +00:00
Stephan Mueller
55c8b0dc68 Fix memory corruption by initlizalizing pointer
A memory corruption in protobuf_c_message_free_unpacked happens at the
following line:

        if (message->unknown_fields != NULL)
                do_free(allocator, message->unknown_fields);

The do_free will free ->unknown_fields. This is may be wrong, because
protobuf_c_message_unpack uses malloc as the default allocator, allocates
rv with malloc. At the end, however, ->unknown_fields is only initialized
if there are some. That means if there are no such fields ->unknown_fields
is an uninitialized pointer.

The patch initializes the pointer to NULL to ensure the check before free
is performed on initialized memory in case there is no unknown_field.

This fixes https://github.com/protobuf-c/protobuf-c/issues/690

Signed-off-by: Stephan Mueller <smueller@chronox.de>
2024-01-21 11:10:25 +01:00
Alessandro Bono
493b379966 Makefile.am: Distribute missing Config.cmake.in
Closes: https://github.com/protobuf-c/protobuf-c/issues/698
2023-12-16 10:41:54 +01:00
Alessandro Bono
9b1d4a355b CMakeList.txt: Remove double hyphens
Otherwise cmake won't reconize the command.

With double hyphens:
```
$ cmake -E env TESTENV=value -- env | grep TESTENV
cmake -E env: unknown option '--'
```

Without double hyphens:
```
$ cmake -E env TESTENV=value env | grep TESTENV
TESTENV=value
```
2023-12-15 19:49:09 +01:00
Dimitri Papadopoulos
67b1c3535d Remove the executable bits from protobuf-c/protobuf-c.h
[edmonds: Adjust commit message.]
2023-11-29 21:56:22 -05:00
Robert Edmonds
86a692922b Makefile.am: Distribute the missing changelog files (CHANGELOG.md, ChangeLog.old) 2023-11-25 19:05:15 -05:00
Robert Edmonds
8c201f6e47 CHANGELOG.md: 1.5.0 v1.5.0 2023-11-25 18:21:08 -05:00
Robert Edmonds
6600fd55b9 Bump version to 1.5.0 2023-11-25 18:21:08 -05:00
Robert Edmonds
a15d80a136 Bump copyright years to 2023 2023-11-25 18:04:11 -05:00
Robert Edmonds
ba4c55f0e6
Merge pull request #685 from MiguelBarro/static_msvc_fix
Fixing MSVC build for Msbuild and Makefile generators
2023-09-21 17:00:11 -04:00
Guybrush
5db0ca5a28 enforcing reviewers comments
Signed-off-by: Guybrush <miguel.barro@live.com>
2023-09-18 18:37:01 +02:00
Guybrush
aee40e9569 Setting default repos on msvc binary generator
Signed-off-by: Guybrush <miguel.barro@live.com>
2023-09-15 12:12:15 +02:00
Guybrush
6ad31f8d43 Dispatch workflow to generate binaries.
Led to some fixes in the CMake too.

Signed-off-by: Guybrush <miguel.barro@live.com>
2023-09-15 12:04:00 +02:00
MiguelBarro
61933280db Fix tests on windows by adding plugin dir to environment PATH
Signed-off-by: MiguelBarro <miguelbarro@eprosima.com>
2023-09-11 10:09:15 +02:00
MiguelBarro
01bd9bed77
Fixing static lib generation on MSVC
Signed-off-by: MiguelBarro <miguelbarro@eprosima.com>
2023-09-11 00:06:48 +02:00
Robert Edmonds
fa86fddbd0
Merge pull request #677 from protobuf-c/edmonds/compiler-diagnostics
Silence some compiler diagnostics
2023-07-09 00:39:00 -04:00
Robert Edmonds
a255fb20ae test-generated-code2: Ignore -Wdeclaration-after-statement
This file uses declarations after statements and fixing it would make
the code less readable, so silence this particular diagnostic in this
particular file.
2023-07-09 00:00:12 -04:00
Robert Edmonds
7f006f8ad5 configure.ac: Drop -Wc99-c11-compat
This diagnostic isn't particularly useful since it fires on generated
.pb-c.h files.
2023-07-09 00:00:12 -04:00
Robert Edmonds
94d8a28db5
Merge pull request #676 from protobuf-c/edmonds/protobuf2-removal
Remove protobuf 2.x support
2023-07-08 23:59:41 -04:00
Robert Edmonds
20d45b1179 t/: Add syntax = "proto2"; where necessary to silence protoc
Since we now require protobuf >= 3.0.0, we don't have to support older
protobuf versions that don't recognize the `syntax` syntax, so we can
put `syntax = "proto2";` on these proto files to silence the protoc
compiler's diagnostic "No syntax specified for the proto file".
2023-07-08 23:19:16 -04:00
Robert Edmonds
824a7fed75 cmake: Remove BUILD_PROTO3, HAVE_PROTO3 2023-07-08 23:15:14 -04:00
Robert Edmonds
e08fe62565 protoc-c/c_helpers.h: Remove HAVE_PROTO3 conditional 2023-07-08 23:14:23 -04:00
Robert Edmonds
7ed03a715b protoc-c/c_file.cc: Remove HAVE_PROTO3 conditional 2023-07-08 23:13:59 -04:00
Robert Edmonds
5c4be20f1b Makefile.am: Remove conditional BUILD_PROTO3 rules
Now that we require protobuf >= 3.0.0, we are always building with
proto3 syntax support.

Note that the test-generated-code3 test keeps `-DPROTO3` which is
separate from the HAVE_PROTO3 identifier. This test is building built
from the same source file as test-generated-code but the source file
supports proto2 and proto3 syntax depending on how it's compiled.
2023-07-08 23:11:54 -04:00
Robert Edmonds
7dca1c382c configure.ac: Remove proto3_supported, BUILD_PROTO3
Since we require protobuf >= 3.0.0 now, the proto3 syntax is always
supported.
2023-07-08 23:11:03 -04:00
Robert Edmonds
f46c1fd603
Merge pull request #675 from protobuf-c/edmonds/misc-fixes
Miscellaneous fixes
2023-07-08 22:40:07 -04:00
Robert Edmonds
cda9f84752 protoc-c: Silence compilers that complain about sprintf() 2023-07-08 21:45:14 -04:00
Robert Edmonds
951a5278e0 protobuf-c: pack_buffer_packed_payload(): Remove unused increment
Since this case immediately returns, the `rv` variable is not used.

See https://github.com/protobuf-c/protobuf-c/issues/517.
2023-07-08 21:34:09 -04:00
Robert Edmonds
bee044643e protobuf-c: parse_required_member(): Remove duplicate NULL check
`*pstr != NULL` was already checked here.

See https://github.com/protobuf-c/protobuf-c/issues/517.
2023-07-08 21:31:23 -04:00
Robert Edmonds
0ce231b16d cmake: Add -I${PROTOBUF_INCLUDE_DIR} to protoc invocation
Apparently in some cases the protobuf compiler is unable to find its own
files, and this fix has been reported to work.

See https://github.com/protobuf-c/protobuf-c/issues/491.
2023-07-08 21:18:06 -04:00
Daniel Egger
d465ae9d44 Fix codesmell "or with 0" in generated flags
Signed-off-by: Daniel Egger <daniel@eggers-club.de>

[edmonds: From https://github.com/protobuf-c/protobuf-c/pull/523.]

[edmonds: Adjust find string from "0 |" to "0 | ", test against `== 0`
rather than `!= std::string::npos` so that the find/erase calls are
anchored to the same portion of the string.]
2023-07-08 21:00:36 -04:00
Robert Edmonds
5312647592 protoc-c: Rename 'legacy_name' to 'standalone_name' 2023-07-08 20:52:25 -04:00
Robert Edmonds
de5ea41b4f t/: Use "int main(void)" for the main C signature
This commit updates a few tests where we aren't using the correct C
signature for main() or are not using any of its parameters (in the
case of t/version/version.c.)
2023-07-08 20:52:09 -04:00
Robert Edmonds
2c63d76205 protoc-c: Fix -Wsign-compare diagnostics
This commit fixes the following compiler diagnostics:

    ../protoc-c/c_helpers.cc: In function ‘void google::protobuf::compiler::c::PrintComment(google::protobuf::io::Printer*, std::__cxx11::string)’:
    ../protoc-c/c_helpers.cc:221:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::__cxx11::basic_string<char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
           for (int i = 0; i < comment_lines.size(); i++)
                           ~~^~~~~~~~~~~~~~~~~~~~~~
    ../protoc-c/c_helpers.cc: In function ‘std::set<std::__cxx11::basic_string<char> > google::protobuf::compiler::c::MakeKeywordsMap()’:
    ../protoc-c/c_helpers.cc:273:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
       for (int i = 0; i < GOOGLE_ARRAYSIZE(kKeywordList); i++) {
                         ^
2023-07-08 20:50:57 -04:00
Robert Edmonds
69fc2f13bb
Merge pull request #673 from protobuf-c/edmonds/new-google-support
Support for new Google protobuf 22.x, 23.x releases
2023-07-08 20:17:30 -04:00
Robert Edmonds
5b0661f1e8 configure.ac: Require C++17
There are some recent reports of strange build failures that might have
been fixed by compiling in C++17 mode, so it might be a good idea to use
C++17 in general, and not just when building against very recent
protobuf versions.

Since it looks like we've lost protobuf < 3.0.0 support, configure.ac
can be simplified a bit if we just use C++17 by default.
2023-07-03 01:10:28 -04:00
Robert Edmonds
7582b6e7d6 cmake: Require C++17
Newer versions of protobuf apparently don't build with older versions of
the C++ standard.
2023-07-02 22:58:48 -04:00