From feb409071dc33c55bf7b8f45e1a046137c590109 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 13 Jul 2025 15:09:06 -0300 Subject: [PATCH] markused: whitelist `_option_none` too (fix #24862) (#24885) --- vlib/builtin/option.v | 1 + vlib/v/tests/skip_unused/struct_field_none.run.out | 1 + .../skip_unused/struct_field_none.skip_unused.run.out | 1 + vlib/v/tests/skip_unused/struct_field_none.vv | 10 ++++++++++ 4 files changed, 13 insertions(+) create mode 100644 vlib/v/tests/skip_unused/struct_field_none.run.out create mode 100644 vlib/v/tests/skip_unused/struct_field_none.skip_unused.run.out create mode 100644 vlib/v/tests/skip_unused/struct_field_none.vv diff --git a/vlib/builtin/option.v b/vlib/builtin/option.v index 45aed3331..c11b4a4c6 100644 --- a/vlib/builtin/option.v +++ b/vlib/builtin/option.v @@ -21,6 +21,7 @@ struct _option { // derived _option_xxx types } +@[markused] fn _option_none(data voidptr, mut option _option, size int) { unsafe { *option = _option{ diff --git a/vlib/v/tests/skip_unused/struct_field_none.run.out b/vlib/v/tests/skip_unused/struct_field_none.run.out new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/vlib/v/tests/skip_unused/struct_field_none.run.out @@ -0,0 +1 @@ +{} diff --git a/vlib/v/tests/skip_unused/struct_field_none.skip_unused.run.out b/vlib/v/tests/skip_unused/struct_field_none.skip_unused.run.out new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/vlib/v/tests/skip_unused/struct_field_none.skip_unused.run.out @@ -0,0 +1 @@ +{} diff --git a/vlib/v/tests/skip_unused/struct_field_none.vv b/vlib/v/tests/skip_unused/struct_field_none.vv new file mode 100644 index 000000000..b0ee5e6e0 --- /dev/null +++ b/vlib/v/tests/skip_unused/struct_field_none.vv @@ -0,0 +1,10 @@ +import json + +pub struct Struct { + version ?int // = none +} + +fn main() { + s := Struct{} + println('${json.encode(s)}') +} -- 2.39.5