WIP: Fix cmocka 2.0 compatibility #69

Closed
jabber.developer2 wants to merge 1 commits from fix/cmocka-2.0-compatibility into master
Collaborator

Description:

Problem

cmocka 2.0 (released December 2025) deprecated several APIs used by profanity unit tests:

  • will_return() → use will_return_int(), will_return_ptr()
  • check_expected() → use check_expected_int(), check_expected_ptr()
  • mock_type() → use mock_int(), mock_ptr_type()

This breaks CI builds on rolling-release distros:

  • Debian testing (cmocka 2.0.1)
  • openSUSE Tumbleweed (cmocka 2.0.2)

Solution

Add CMOCKA_DISABLE_DEPRECATION_WARNINGS define in prof_cmocka.h before including <cmocka.h>. This suppresses deprecation warnings and allows deprecated APIs to work correctly in cmocka 2.0.

This is the recommended approach by cmocka maintainers for projects that need to support both cmocka 1.x and 2.x.

Changes

  • prof_cmocka.h: Add #define CMOCKA_DISABLE_DEPRECATION_WARNINGS 1 before cmocka include

Testing

  • Tested with cmocka 1.1.x (Debian bookworm, Fedora, Arch, Ubuntu)
  • Tested with cmocka 2.0.x (Debian testing)

Future work

Consider migrating to type-safe cmocka 2.0 APIs (will_return_int(), mock_int(), etc.) for better type checking. This would require ~300 changes across test files.

**Description:** ### Problem cmocka 2.0 (released December 2025) deprecated several APIs used by profanity unit tests: - `will_return()` → use `will_return_int()`, `will_return_ptr()` - `check_expected()` → use `check_expected_int()`, `check_expected_ptr()` - `mock_type()` → use `mock_int()`, `mock_ptr_type()` This breaks CI builds on rolling-release distros: - Debian testing (cmocka 2.0.1) - openSUSE Tumbleweed (cmocka 2.0.2) ### Solution Add `CMOCKA_DISABLE_DEPRECATION_WARNINGS` define in prof_cmocka.h before including `<cmocka.h>`. This suppresses deprecation warnings and allows deprecated APIs to work correctly in cmocka 2.0. This is the recommended approach by cmocka maintainers for projects that need to support both cmocka 1.x and 2.x. ### Changes - prof_cmocka.h: Add `#define CMOCKA_DISABLE_DEPRECATION_WARNINGS 1` before cmocka include ### Testing - ✅ Tested with cmocka 1.1.x (Debian bookworm, Fedora, Arch, Ubuntu) - ✅ Tested with cmocka 2.0.x (Debian testing) ### Future work Consider migrating to type-safe cmocka 2.0 APIs (`will_return_int()`, `mock_int()`, etc.) for better type checking. This would require ~300 changes across test files.
jabber.developer2 added 1 commit 2026-01-16 13:44:54 +00:00
feat: update compatibility header for cmocka 2.0 deprecation handling
All checks were successful
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Check coding style (pull_request) Successful in 34s
CI Code / Linux (debian) (pull_request) Successful in 1h5m4s
CI Code / Linux (ubuntu) (pull_request) Successful in 1h7m47s
CI Code / Linux (arch) (pull_request) Successful in 1h8m8s
aee32ecbf8
jabber.developer changed title from Fix cmocka 2.0 compatibility to WIP: Fix cmocka 2.0 compatibility 2026-01-17 16:37:59 +00:00
Author
Collaborator

Not needed anymore

Not needed anymore
jabber.developer2 deleted branch fix/cmocka-2.0-compatibility 2026-06-19 07:24:15 +00:00
Some checks are pending
CI Code / Check spelling (pull_request) Successful in 19s
Required
Details
CI Code / Check coding style (pull_request) Successful in 34s
Required
Details
CI Code / Linux (debian) (pull_request) Successful in 1h5m4s
Required
Details
CI Code / Linux (ubuntu) (pull_request) Successful in 1h7m47s
Required
Details
CI Code / Linux (arch) (pull_request) Successful in 1h8m8s
Required
Details
CI Code / Code Coverage (pull_request)
Required

Pull request closed

Sign in to join this conversation.
No description provided.