Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/latest-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ jobs:
cargo update --verbose

- name: Build with feature combinations
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ matrix.runner_os != 'ubuntu-22.04' || endsWith(matrix.target, '-musl') }}
run: >-
cargo hack --each-feature
build --locked

- name: Run tests (bins/lib/tests/examples) with feature combinations
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# Disable tests for musl libc target(s) due to build failure for unknown reasons.
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ !endsWith(matrix.target, '-musl') }}
if: ${{ matrix.runner_os != 'ubuntu-22.04' && !endsWith(matrix.target, '-musl') }}
run: >-
cargo hack --each-feature
test --locked
Expand All @@ -120,15 +124,19 @@ jobs:
# certain features only for some doctests, so we run them without
# `cargo-hack`.
- name: Run doctests with all features enabled
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# Disable tests for musl libc target(s) due to build failure for unknown reasons.
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ !endsWith(matrix.target, '-musl') }}
if: ${{ matrix.runner_os != 'ubuntu-22.04' && !endsWith(matrix.target, '-musl') }}
run: >-
cargo test
--locked --all-features
--doc

- name: Build package with all features enabled
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ matrix.runner_os != 'ubuntu-22.04' || endsWith(matrix.target, '-musl') }}
# We allow dirty state here because it is only expected after update.
run: >-
cargo package
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,18 @@ jobs:
shared-key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.target }}-${{ matrix.runner_os }}

- name: Build with feature combinations
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ matrix.runner_os != 'ubuntu-22.04' || endsWith(matrix.target, '-musl') }}
run: >-
cargo hack --each-feature
build --locked

- name: Run tests (bins/lib/tests/examples) with feature combinations
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# Disable tests for musl libc target(s) due to build failure for unknown reasons.
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ !endsWith(matrix.target, '-musl') }}
if: ${{ matrix.runner_os != 'ubuntu-22.04' && !endsWith(matrix.target, '-musl') }}
run: >-
cargo hack --each-feature
test --locked
Expand All @@ -136,15 +140,19 @@ jobs:
# certain features only for some doctests, so we run them without
# `cargo-hack`.
- name: Run doctests with all features enabled
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# Disable tests for musl libc target(s) due to build failure for unknown reasons.
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ !endsWith(matrix.target, '-musl') }}
if: ${{ matrix.runner_os != 'ubuntu-22.04' && !endsWith(matrix.target, '-musl') }}
run: >-
cargo test
--locked --all-features
--doc

- name: Build package with all features enabled
# Disable build for GNU targets on Ubuntu 22.04 (unsupported `atomic_uintptr_t`).
# TODO: Try to re-enable this step regardless of the build target in the future.
if: ${{ matrix.runner_os != 'ubuntu-22.04' || endsWith(matrix.target, '-musl') }}
run: >-
cargo package
--locked --all-features
19 changes: 11 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.22.0
rev: v0.22.1
hooks:
- id: markdownlint-cli2
- repo: https://github.com/codespell-project/codespell
Expand All @@ -31,23 +31,26 @@ repos:
- id: codespell
args: [--ignore-words=.codespellignore]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.37.1
rev: 0.37.2
hooks:
- id: check-github-actions
- id: check-github-workflows
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
- id: taplo-lint
# The taplo-lint checks have been disabled, because they only work with
# the newest Rust version and don't respect the `rust-version` field in
# `Cargo.toml`.
# - repo: https://github.com/ComPWA/taplo-pre-commit
# rev: v0.9.3
# hooks:
# - id: taplo-lint
# Format code with oxfmt for supported file types.
- repo: https://github.com/oxc-project/mirrors-oxfmt
rev: v0.43.0
rev: v0.45.0
hooks:
- id: oxfmt
types_or:
- json
- markdown
- toml
- yaml
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Breaking: Upgrade to open62541 version
[1.5.4](https://github.com/open62541/open62541/releases/tag/v1.5.4).

## [0.5.4] - 2026-03-16

### Fixed
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "open62541-sys"
version = "0.5.4"
version = "0.6.0"
authors = ["HMI Project"]
edition = "2024"
# Keep MSRV in sync with `test.yaml`/`build.rs`. Use versions that are at least 6 months old.
Expand Down Expand Up @@ -59,8 +59,8 @@ include = [

[build-dependencies]
bindgen = { version = "0.72.1" }
cc = "1.2.56"
cmake = "0.1.57"
cc = "1.2.58"
cmake = "0.1.58"
version_check = "0.9.5"

[features]
Expand Down
2 changes: 1 addition & 1 deletion open62541
Submodule open62541 updated 758 files
38 changes: 10 additions & 28 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,23 @@ use open62541_sys::{
va_list_,
};

// Check validity of explicitly defined type aliases.
#[test]
fn variadic_arguments() {
// Check if `va_list_` type matches.
fn type_aliases() {
const unsafe extern "C" fn log_c(
_log_context: *mut ffi::c_void,
_level: UA_LogLevel,
_category: UA_LogCategory,
_msg: *const ffi::c_char,
_args: va_list_,
) {
// Nothing here.
}
let _logger = UA_Logger {
log: Some(log_c),
context: ptr::null_mut(),
clear: None,
};
}

#[test]
fn logger_types() {
// Check validity of type aliases for `UA_Logger` callbacks.
const unsafe extern "C" fn log_c(
_log_context: *mut ffi::c_void,
_level: UA_LogLevel,
_category: UA_LogCategory,
_msg: *const ffi::c_char,
_args: va_list_,
) {
const unsafe extern "C" fn clear_c(_logger: *mut UA_Logger) {
// Nothing here.
}
const unsafe extern "C" fn clear_c(_logger: *mut UA_Logger) {}

let log: UA_LoggerLogCallback_ = Some(log_c);
let clear: UA_LoggerClearCallback_ = Some(clear_c);
let _logger = UA_Logger {
Expand All @@ -44,16 +31,11 @@ fn logger_types() {
};
}

// Make sure that our custom exports (prefixed with `RS_`) are available under their expected names,
// i.e. without the `RS_` prefix.
#[test]
fn has_custom_exports() {
// Make sure that our custom exports (prefixed internally with `RS_`) are available under their
// expected names.
//
use open62541_sys::{UA_EMPTY_ARRAY_SENTINEL, vsnprintf_va_copy, vsnprintf_va_end};
fn custom_exports() {
use open62541_sys::UA_EMPTY_ARRAY_SENTINEL;

#[expect(clippy::no_effect_underscore_binding, reason = "check existence")]
let _unused = vsnprintf_va_copy;
#[expect(clippy::no_effect_underscore_binding, reason = "check existence")]
let _unused = vsnprintf_va_end;
let _unused = unsafe { UA_EMPTY_ARRAY_SENTINEL };
}
56 changes: 1 addition & 55 deletions wrapper.c
Original file line number Diff line number Diff line change
@@ -1,61 +1,7 @@
#include "wrapper.h"

// Wrapper for `vsnprintf()` with normalized behavior across different platforms
// such as Microsoft Windows.
//
// Other than the standard `vsnprintf()`, this function does not consume the
// passed `va_list` argument! The caller is responsible for calling
// `vsnprintf_va_end()` on the `va_list` argument eventually.
#if defined(_MSC_VER) && _MSC_VER < 1900
int RS_vsnprintf_va_copy(
char *buffer,
size_t count,
const char *format,
va_list args)
{
// Microsoft does not (always) define a standard-conforming `vsnprintf()`. But
// it does define a variant with slightly different behavior. We normalize the
// differences as best we can.
int result = -1;
if (count)
{
va_list args_copied;
va_copy(args_copied, args);
result = _vsnprintf_s(buffer, count, _TRUNCATE, format, args_copied);
}
if (result < 0)
{
va_list args_copied;
va_copy(args_copied, args);
result = _vscprintf(format, args_copied);
}

return result;
}
#else
int RS_vsnprintf_va_copy(
char *buffer,
size_t count,
const char *format,
va_list args)
{
// Forward to existing standards-compliant function. It may have be defined as
// a macro, so we need a wrapper function for bindgen to pick it up anyway.
va_list args_copied;
va_copy(args_copied, args);
int result = vsnprintf(buffer, count, format, args_copied);

return result;
}
#endif

void RS_vsnprintf_va_end(va_list args)
{
va_end(args);
}

// bindgen does not support non-trivial `#define` used for pointer constant. Use
// statically defined constant as workaround for now.
//
// See https://github.com/rust-lang/rust-bindgen/issues/2426
// See <https://github.com/rust-lang/rust-bindgen/issues/2426>.
const void *const RS_UA_EMPTY_ARRAY_SENTINEL = UA_EMPTY_ARRAY_SENTINEL;
Loading
Loading