This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch eolian/improvements
in repository efl.
View the commit online.
commit 77c525b86bf8fbec2013443cd8e278cc602148cc
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Aug 20 18:00:04 2026 -0600
eo: annotate @nullable from what C actually does, and gate it
@nullable is what a binding generator reads to decide a C# `?`, a C++
optional, or a Go pointer. Across stable API it was almost absent: 16 of
112 reference-typed returns carried it, all from documentation that
already said so, so any generator honouring it would have encoded the
claim that 96 functions never return NULL. Some provably do.
Annotated from evidence rather than by eye. Every implementation body in
the tree is reachable through the op tables the generated .eo.c files
carry, so the question "does this ever return NULL" has an answer in the
source. Stable sites now annotated: returns 16 -> 42, in-parameters
16 -> 32, out-parameters 2 -> 6.
The discipline that matters is the other direction. @nullable marks NULL
as a legitimate answer within the contract -- "there is no such thing".
It does not mark allocation failure, precondition violation, or internal
error, and annotating those would make nearly every pointer in the API
nullable and leave the annotation carrying no information. Eight
functions that contain a literal `return NULL` are deliberately left
unannotated for that reason and listed with the reason in the checker:
Efl.Loop.timeout and .idle fail only if the promise cannot be allocated,
four iterator getters only if a calloc fails, and so on. An empty clip
list still yields a valid iterator.
Three properties needed splitting rather than annotating, because the
getter answers NULL but the setter refuses it:
Efl.Text_Font_Properties.font_family (EINA_SAFETY_ON_NULL_RETURN),
Efl.Ui.Focus.Manager.manager_focus (likewise) and .root (registers the
value unchecked). A shared values block would have told every generator
that passing null to the setter is fine.
Efl.Model.children_slice_get already documented that it returns
on an invalidated model; it is annotated accordingly.
One documentation bug fell out: Efl.Config.config.set said its value
"may be $null", while the implementation carries a TODO for exactly that
case and would dereference it. Documentation corrected rather than
annotation added.
scripts/check-nullable.py now enforces that the annotation, the
documentation and the C implementation agree, in all three directions,
and runs in the lint suite. It uses eolian's own eo_gen_docs_mentions_null
rule for what counts as mentioning null, so the two cannot drift. The
allowlist is the file's record of every deliberate omission.
pyolian gained the two wrappers this needed: eolian_parameter_is_nullable
and eolian_function_return_is_nullable were in the C API and unbound.
Generated C is unaffected -- eolian consumes @nullable only in docs.c,
never in signature generation, and the headers are byte-identical.
Co-Authored-By: Claude Opus 5 <[email protected]>
---
scripts/check-nullable.py | 254 +++++++++++++++++++++
src/lib/edje/efl_layout_group.eo | 3 +-
src/lib/efl/interfaces/efl_config.eo | 10 +-
src/lib/efl/interfaces/efl_container.eo | 3 +-
src/lib/efl/interfaces/efl_content.eo | 4 +-
src/lib/efl/interfaces/efl_gfx_filter.eo | 3 +-
src/lib/efl/interfaces/efl_model.eo | 15 +-
src/lib/efl/interfaces/efl_pack_linear.eo | 10 +-
src/lib/efl/interfaces/efl_pack_table.eo | 2 +-
src/lib/efl/interfaces/efl_part.eo | 3 +-
src/lib/efl/interfaces/efl_text_font_properties.eo | 15 +-
src/lib/elementary/efl_access_action.eo | 10 +-
src/lib/elementary/efl_access_object.eo | 2 +-
src/lib/elementary/efl_access_text.eo | 3 +-
src/lib/elementary/efl_config_global.eo | 2 +-
src/lib/elementary/efl_ui_dnd.eo | 2 +-
src/lib/elementary/efl_ui_focus_manager.eo | 39 +++-
src/lib/elementary/efl_ui_focus_manager_calc.eo | 4 +-
src/lib/elementary/efl_ui_focus_object.eo | 6 +-
src/lib/elementary/efl_ui_format.eo | 3 +-
src/lib/elementary/efl_ui_relative_container.eo | 8 +-
src/lib/elementary/efl_ui_view_model.eo | 4 +-
.../elementary/efl_ui_widget_scrollable_content.eo | 6 +-
src/lib/eo/efl_object.eo | 10 +-
src/lib/evas/canvas/efl_canvas_group.eo | 4 +-
src/lib/evas/canvas/efl_canvas_object.eo | 2 +-
src/lib/evas/canvas/efl_canvas_object_animation.eo | 3 +-
src/lib/evas/canvas/efl_input_device.eo | 3 +-
src/scripts/pyolian/eolian.py | 7 +
src/scripts/pyolian/eolian_lib.py | 8 +
src/tests/meson.build | 14 ++
31 files changed, 396 insertions(+), 66 deletions(-)
diff --git a/scripts/check-nullable.py b/scripts/check-nullable.py
new file mode 100755
index 0000000000..0c8897e184
--- /dev/null
+++ b/scripts/check-nullable.py
@@ -0,0 +1,254 @@
+#!/usr/bin/env python3
+"""Check that @nullable, the documentation, and the C implementation agree.
+
+Three things have to say the same thing about whether NULL is a legal value,
+and nothing keeps them in step:
+
+ 1. `@nullable` in the .eo -- what binding generators read. A C# `?`, a C++
+ `optional`, a Go pointer-vs-value decision all come from here.
+ 2. The documentation -- what a person reads.
+ 3. The C implementation -- what actually happens.
+
+This script fails when they disagree:
+
+ MISSING-DOC a site is @nullable but its documentation never mentions null.
+ eolian papers over this when it generates documentation, by
+ appending "May be NULL" itself -- but the .eo is what a person
+ reads and what every other generator sees, so say it there.
+ MISSING-ANNOT the documentation says null is allowed but the site is not
+ annotated, so every generator will get it wrong. Phrases that
+ say the opposite ("must not be $null") are not counted.
+ MISSING-NULL a stable function provably returns NULL on a path that is not
+ an allocation failure or a precondition violation, and is not
+ annotated.
+
+What `@nullable` means here, and the reason for the ALLOWED_UNANNOTATED list
+below: it marks NULL as a legitimate answer *within the contract* -- "there is
+no such thing". It does not mark allocation failure, precondition violation or
+internal error. Annotating those would make every pointer in the API nullable
+and the annotation would stop carrying information.
+
+Usage: scripts/check-nullable.py [build-dir] (default: build)
+"""
+
+import collections
+import glob
+import os
+import re
+import sys
+
+BUILD = sys.argv[1] if len(sys.argv) > 1 else 'build'
+ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+sys.path.insert(0, os.path.join(ROOT, 'src', 'scripts', 'pyolian'))
+os.environ.setdefault('EOLIAN_LIB', os.path.join(BUILD, 'src/lib/eolian/libeolian.so.1'))
+
+import eolian # noqa: E402
+from eolian import Eolian_Function_Type as FT # noqa: E402
+
+# Returns NULL only on a path that is not part of the contract. Each of these
+# was read; the reason is why annotating it would be wrong, not an excuse.
+ALLOWED_UNANNOTATED = {
+ 'efl_canvas_object_clipped_objects_get': 'calloc failure only; an empty clip list still yields an iterator',
+ 'efl_canvas_textblock_anchors_get': 'calloc failure only',
+ 'efl_input_device_children_iterate': 'calloc failure only',
+ 'efl_pack_table_contents_get': 'calloc failure only',
+ 'efl_loop_idle': 'promise allocation failure only',
+ 'efl_loop_timeout': 'promise allocation failure only',
+ 'efl_canvas_textblock_async_layout': 'promise allocation failure only',
+ 'efl_duplicate': 'fails only if the new object could not be created',
+}
+
+# The same notion eolian itself uses in eo_gen_docs_mentions_null(): "null",
+# any case, not the tail of a longer word. That function decides whether the
+# generated documentation gets an automatic "May be NULL" appended, so using
+# a different rule here would let the two disagree about the same doc string.
+SAYS_NULL = re.compile(r'null(?![a-zA-Z0-9])', re.I)
+# "must not be $null", "never $null", "non-null" -- up to a couple of words
+# between the negation and the word itself.
+SAYS_NOT_NULL = re.compile(r'\b(not|never|non-?)\b(\s+\w+){0,2}\s*\$?NULL\b', re.I)
+
+SAFETY = re.compile(r'EINA_SAFETY_ON_\w+|_DATA_GET_OR_RETURN|\bERR\s*\(|\bCRI\s*\(')
+ALLOC = re.compile(r'\b(calloc|malloc|realloc|eina_promise_new|efl_loop_promise_simple_data_calloc)\s*\(')
+
+
+def load_state():
+ st = eolian.Eolian_State()
+ for d in set(os.path.dirname(p) for p in
+ glob.glob(os.path.join(ROOT, 'src/lib/**/*.eo*'), recursive=True)):
+ st.directory_add(d)
+ if not st.all_eot_files_parse() or not st.all_eo_files_parse():
+ sys.exit('eolian failed to parse the tree')
+ return st
+
+
+def doctext(d):
+ if d is None:
+ return ''
+ return ' '.join(str(getattr(d, a)) for a in ('summary', 'description')
+ if getattr(d, a, None))
+
+
+def is_ref(t):
+ return t is not None and (t.c_type or '').rstrip().endswith('*')
+
+
+FTYPES = {FT.METHOD: [FT.METHOD], FT.PROPERTY: [FT.PROP_GET, FT.PROP_SET],
+ FT.PROP_GET: [FT.PROP_GET], FT.PROP_SET: [FT.PROP_SET]}
+
+
+def collect(state):
+ """Every reference-typed site in stable API, with its flag and its doc.
+
+ Also returns, per function, whether the value C hands back is @nullable.
+ A property getter with one value and no keys returns that value in C, so
+ that is the site the return-side check has to look at -- not a `return:`
+ clause, which such a property does not have.
+ """
+ rows = []
+ returns = {}
+ strict = {}
+ for cls in state.classes:
+ for func in list(cls.functions_get(FT.METHOD)) + list(cls.functions_get(FT.PROPERTY)):
+ for ftype in FTYPES.get(func.type, []):
+ cname = func.full_c_name_get(ftype)
+ if not cname or cls.is_beta or func.is_beta:
+ continue
+ rt = func.return_type_get(ftype)
+ if is_ref(rt):
+ rows.append((cname, '<return>', bool(func.return_is_nullable(ftype)),
+ doctext(func.return_documentation(ftype))))
+ returns[cname] = bool(func.return_is_nullable(ftype))
+ if ftype in (FT.PROP_GET, FT.PROP_SET):
+ keys = list(func.keys_get(ftype))
+ vals = list(func.values_get(ftype))
+ params = keys + vals
+ # A getter with exactly one value returns it in C rather
+ # than filling an out-parameter -- keys or not:
+ # Eina_Value *efl_config_get(const Eo *, const char *name)
+ # This is the same -1 convention check-eo-c-fidelity.py
+ # accounts for.
+ if (ftype is FT.PROP_GET and rt is None
+ and len(vals) == 1 and is_ref(vals[0].type)):
+ returns[cname] = bool(vals[0].is_nullable)
+ else:
+ params = list(func.parameters)
+ for p in params:
+ if is_ref(p.type):
+ rows.append((cname, p.name, bool(p.is_nullable), doctext(p.documentation)))
+ if not p.is_nullable:
+ strict.setdefault(cname, set()).add(p.name)
+ return rows, returns, strict
+
+
+def c_bodies():
+ """Public eo function name -> implementation bodies, via the generated op tables."""
+ impls = collections.defaultdict(list)
+ for f in glob.glob(os.path.join(BUILD, 'src/**/*.eo.c'), recursive=True):
+ for m in re.finditer(r'EFL_OBJECT_OP_FUNC\(\s*(\w+)\s*,\s*(\w+)\s*\)',
+ open(f, errors='replace').read()):
+ if m.group(2) != 'NULL':
+ impls[m.group(1)].append(m.group(2))
+
+ src = "" open(f, errors='replace').read()
+ for f in glob.glob(os.path.join(ROOT, 'src/**/*.c'), recursive=True)}
+
+ def body(name):
+ for text in src.values():
+ for m in re.finditer(r'\n' + re.escape(name) + r'\s*\(', text):
+ i = text.find(')', m.end())
+ while i != -1 and text[i + 1:].lstrip()[:1] != '{':
+ i = text.find(')', i + 1)
+ if i == -1 or i - m.end() > 2000:
+ return None
+ if i == -1:
+ return None
+ b = text.index('{', i)
+ depth, j = 0, b
+ while j < len(text):
+ if text[j] == '{':
+ depth += 1
+ elif text[j] == '}':
+ depth -= 1
+ if depth == 0:
+ return text[b:j + 1]
+ j += 1
+ return None
+ return impls, body
+
+
+def returns_contract_null(text, strict_params=()):
+ """A `return NULL` that is part of the contract.
+
+ Three kinds of `return NULL` are not:
+ - a safety-macro bailout,
+ - an allocation failure,
+ - a guard on a parameter the API says must not be null, which is a
+ precondition violation and not an answer.
+ """
+ lines = [ln for ln in text.split('\n') if not SAFETY.search(ln)]
+ for i, ln in enumerate(lines):
+ if not re.search(r'\breturn\s+NULL\s*;', ln):
+ continue
+ ctx = '\n'.join(lines[max(0, i - 6):i + 1])
+ guard = None
+ for back in range(i, max(-1, i - 3), -1):
+ g = re.search(r'if\s*\((.*)\)', lines[back])
+ if g:
+ guard = g.group(1)
+ break
+ if guard:
+ var = re.split(r'[)\s&|]', re.sub(r'^\s*!\s*', '', guard).strip())[0]
+ if var and re.search(re.escape(var) + r'\s*=\s*[^;]*' + ALLOC.pattern, ctx):
+ continue # allocation failure
+ if var in strict_params:
+ continue # precondition on a non-null parameter
+ return True
+ return False
+
+
+def main():
+ rows, returns, strict = collect(load_state())
+
+ missing_doc, missing_annot = [], []
+ for cname, name, nullable, doc in rows:
+ says = bool(SAYS_NULL.search(doc)) and not SAYS_NOT_NULL.search(doc)
+ if nullable and not SAYS_NULL.search(doc):
+ missing_doc.append((cname, name))
+ elif says and not nullable:
+ missing_annot.append((cname, name))
+
+ impls, body = c_bodies()
+ missing_null = []
+ for cname, nullable in sorted(returns.items()):
+ if nullable or cname in ALLOWED_UNANNOTATED:
+ continue
+ for impl in impls.get(cname, []):
+ b = body(impl)
+ if b and returns_contract_null(b, strict.get(cname, ())):
+ missing_null.append((cname, impl))
+ break
+
+ fails = 0
+ print('checked %d reference-typed sites in stable API' % len(rows))
+ for label, items, hint in (
+ ('MISSING-DOC', missing_doc, '@nullable but the documentation never says so'),
+ ('MISSING-ANNOT', missing_annot, 'documentation says null is allowed but @nullable is absent'),
+ ('MISSING-NULL', missing_null, 'returns NULL on a contract path but is not @nullable')):
+ if not items:
+ print(' ok %-14s none' % label)
+ continue
+ fails += len(items)
+ print(' FAIL %-14s %d (%s):' % (label, len(items), hint))
+ for a, b in sorted(items):
+ print(' %-52s %s' % (a, b))
+
+ if fails:
+ print('\n%d disagreement(s) between @nullable, documentation and C.' % fails)
+ return 1
+ print('@nullable, documentation and C agree')
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/src/lib/edje/efl_layout_group.eo b/src/lib/edje/efl_layout_group.eo
index c50a966396..ba388ef00e 100644
--- a/src/lib/edje/efl_layout_group.eo
+++ b/src/lib/edje/efl_layout_group.eo
@@ -94,7 +94,8 @@ interface Efl.Layout.Group
key: string; [[The data field's key string]]
}
values {
- val: string; [[The data's value string.]]
+ val: string @nullable; [[The data's value string, or $null if the group
+ declares no data with that key.]]
}
}
@property part_exist {
diff --git a/src/lib/efl/interfaces/efl_config.eo b/src/lib/efl/interfaces/efl_config.eo
index 449456468c..0879fb887a 100644
--- a/src/lib/efl/interfaces/efl_config.eo
+++ b/src/lib/efl/interfaces/efl_config.eo
@@ -9,9 +9,10 @@ interface @beta Efl.Config
name: string; [[Configuration option name.]]
}
values {
- value: any_value_ref @move;
- [[The value. It will be empty if it doesn't exist. The caller
- must free it after use (using $eina_value_free() in C).]]
+ value: any_value_ref @move @nullable;
+ [[The value, or $null if no option of that name exists. The
+ caller must free it after use (using $eina_value_free()
+ in C).]]
}
}
set {
@@ -20,7 +21,8 @@ interface @beta Efl.Config
}
values {
value: const(any_value_ref);
- [[Configuration option value. May be $null if not found.]]
+ [[Configuration option value. Must not be $null: resetting an
+ option to its default this way is not implemented.]]
}
return: bool; [[$false in case of error: value type was invalid, the
config can't be changed, config does not exist...]]
diff --git a/src/lib/efl/interfaces/efl_container.eo b/src/lib/efl/interfaces/efl_container.eo
index 58f4c18757..83d16308e9 100644
--- a/src/lib/efl/interfaces/efl_container.eo
+++ b/src/lib/efl/interfaces/efl_container.eo
@@ -12,7 +12,8 @@ interface Efl.Container
methods {
content_iterate {
[[Begin iterating over this object's contents.]]
- return: iterator<Efl.Gfx.Entity> @move @no_unused; [[Iterator on object's content.]]
+ return: iterator<Efl.Gfx.Entity> @move @no_unused @nullable; [[Iterator on object's
+ content, or $null if the object holds none.]]
}
content_count {
[[Returns the number of contained sub-objects.]]
diff --git a/src/lib/efl/interfaces/efl_content.eo b/src/lib/efl/interfaces/efl_content.eo
index 25f5fe4caa..c70d4d0fc4 100644
--- a/src/lib/efl/interfaces/efl_content.eo
+++ b/src/lib/efl/interfaces/efl_content.eo
@@ -20,14 +20,14 @@ interface Efl.Content
}
get {}
values {
- content: Efl.Gfx.Entity @nullable; [[The sub-object.]]
+ content: Efl.Gfx.Entity @nullable; [[The sub-object, or $null for none.]]
}
}
content_unset {
[[Remove the sub-object currently set as content of this object and return it.
This object becomes empty.
]]
- return: Efl.Gfx.Entity @nullable; [[Unswallowed object]]
+ return: Efl.Gfx.Entity @nullable; [[Unswallowed object, or $null if there was none.]]
}
}
events {
diff --git a/src/lib/efl/interfaces/efl_gfx_filter.eo b/src/lib/efl/interfaces/efl_gfx_filter.eo
index ecb306f5f3..5d12a7f1f4 100644
--- a/src/lib/efl/interfaces/efl_gfx_filter.eo
+++ b/src/lib/efl/interfaces/efl_gfx_filter.eo
@@ -79,7 +79,8 @@ interface @beta Efl.Gfx.Filter
name: string; [[Buffer name as used in the program.]]
}
values {
- source: Efl.Gfx.Entity; [[Object to use as a source of pixels.]]
+ source: Efl.Gfx.Entity @nullable; [[Object to use as a source of pixels, or
+ $null if no source is bound to that name.]]
}
}
@property filter_data {
diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo
index 5d254ab3d7..415b8624d3 100644
--- a/src/lib/efl/interfaces/efl_model.eo
+++ b/src/lib/efl/interfaces/efl_model.eo
@@ -167,12 +167,12 @@ interface Efl.Model
@in count: uint; [[Range size. If count is 0, start is
ignored.]]
}
- return: future<array<Efl.Object>>; [[A future resolving to the
- requested children, or $null if
- the model has been invalidated:
- such a model has no loop
- scheduler left to attach a
- future to.]]
+ return: future<array<Efl.Object>> @nullable; [[A future resolving to the
+ requested children, or $null if
+ the model has been invalidated:
+ such a model has no loop
+ scheduler left to attach a
+ future to.]]
}
children_index_get {
[[Get children as specified by iterator.
@@ -214,7 +214,8 @@ interface Efl.Model
the event @[Efl.Model.child,added] is raised and the child is
kept alongside the others.
]]
- return: Efl.Object; [[Child object]]
+ return: Efl.Object @nullable; [[Child object, or $null if this model does not
+ support adding children.]]
}
child_del {
[[Remove a child.
diff --git a/src/lib/efl/interfaces/efl_pack_linear.eo b/src/lib/efl/interfaces/efl_pack_linear.eo
index e02a11a42b..d4873ac66f 100644
--- a/src/lib/efl/interfaces/efl_pack_linear.eo
+++ b/src/lib/efl/interfaces/efl_pack_linear.eo
@@ -48,7 +48,7 @@ interface Efl.Pack_Linear extends Efl.Pack
]]
params {
@in subobj: Efl.Gfx.Entity; [[Object to pack before $existing.]]
- @in existing: const(Efl.Gfx.Entity); [[Existing reference sub-object. Must already belong to the container
+ @in existing: const(Efl.Gfx.Entity) @nullable; [[Existing reference sub-object. Must already belong to the container
or be $NULL.]]
}
return: bool; [[$false if $existing could not be found or $subobj
@@ -65,7 +65,7 @@ interface Efl.Pack_Linear extends Efl.Pack
]]
params {
@in subobj: Efl.Gfx.Entity; [[Object to pack after $existing.]]
- @in existing: const(Efl.Gfx.Entity); [[Existing reference sub-object. Must already belong to the container
+ @in existing: const(Efl.Gfx.Entity) @nullable; [[Existing reference sub-object. Must already belong to the container
or be $NULL.]]
}
return: bool; [[$false if $existing could not be found or $subobj
@@ -112,7 +112,8 @@ interface Efl.Pack_Linear extends Efl.Pack
Valid range is $[-count] to $[count-1].
]]
}
- return: Efl.Gfx.Entity; [[The sub-object contained at the given $index.]]
+ return: Efl.Gfx.Entity @nullable; [[The sub-object contained at the given $index,
+ or $null if there is none there.]]
}
pack_index_get {
[[Get the index of a sub-object in this container.]]
@@ -140,7 +141,8 @@ interface Efl.Pack_Linear extends Efl.Pack
Valid range is $[-count] to $[count-1].
]]
}
- return: Efl.Gfx.Entity; [[The sub-object if it could be removed.]]
+ return: Efl.Gfx.Entity @nullable; [[The sub-object if it could be removed,
+ $null otherwise.]]
}
}
}
diff --git a/src/lib/efl/interfaces/efl_pack_table.eo b/src/lib/efl/interfaces/efl_pack_table.eo
index 65ed4a6ed1..82d23b58c7 100644
--- a/src/lib/efl/interfaces/efl_pack_table.eo
+++ b/src/lib/efl/interfaces/efl_pack_table.eo
@@ -36,7 +36,7 @@ interface Efl.Pack_Table extends Efl.Pack
}
table_content_get {
[[Returns a child at a given position, see @.table_contents_get.]]
- return: Efl.Gfx.Entity; [[Child object]]
+ return: Efl.Gfx.Entity @nullable; [[Child object, or $null if that cell is empty.]]
params {
@in col: int; [[Column number]]
@in row: int; [[Row number]]
diff --git a/src/lib/efl/interfaces/efl_part.eo b/src/lib/efl/interfaces/efl_part.eo
index f2917356c4..b231f48c4f 100644
--- a/src/lib/efl/interfaces/efl_part.eo
+++ b/src/lib/efl/interfaces/efl_part.eo
@@ -43,7 +43,8 @@ interface Efl.Part
params {
name: string; [[The part name.]]
}
- return: Efl.Object; [[A (proxy) object, valid for a single call.]]
+ return: Efl.Object @nullable; [[A (proxy) object, valid for a single call, or
+ $null if this object has no such part.]]
}
}
}
diff --git a/src/lib/efl/interfaces/efl_text_font_properties.eo b/src/lib/efl/interfaces/efl_text_font_properties.eo
index 95ccbf2953..e4a526072a 100644
--- a/src/lib/efl/interfaces/efl_text_font_properties.eo
+++ b/src/lib/efl/interfaces/efl_text_font_properties.eo
@@ -76,11 +76,16 @@ interface Efl.Text_Font_Properties {
See also @.font_source.
]]
set {
+ values {
+ font: string; [[The font family name or filename.]]
+ }
}
get {
- }
- values {
- font: string; [[The font family name or filename.]]
+ [[$null when no font has been set on this object.]]
+ values {
+ font: string @nullable; [[The font family name or filename, or $null
+ if none is set.]]
+ }
}
}
@@ -120,7 +125,7 @@ interface Efl.Text_Font_Properties {
Will be used in case the primary font isn't available.
]]
values {
- font_fallbacks: string; [[List of fallback font names.]]
+ font_fallbacks: string @nullable; [[List of fallback font names, or $null for none.]]
}
}
@@ -163,7 +168,7 @@ interface Efl.Text_Font_Properties {
"auto" to use the system locale, or "none".
]]
values {
- lang: string; [[Language code.]]
+ lang: string @nullable; [[Language code, or $null for none.]]
}
}
diff --git a/src/lib/elementary/efl_access_action.eo b/src/lib/elementary/efl_access_action.eo
index 9f1d557568..74fae8a570 100644
--- a/src/lib/elementary/efl_access_action.eo
+++ b/src/lib/elementary/efl_access_action.eo
@@ -10,7 +10,8 @@ mixin @beta Efl.Access.Action
get {
}
values {
- name: string; [[Action name]]
+ name: string @nullable; [[Action name, or $null if there is no action
+ with that id.]]
}
keys {
id: int; [[ID to get action name for]]
@@ -35,7 +36,8 @@ mixin @beta Efl.Access.Action
return: bool; [[$true if description was set, $false otherwise]]
}
values {
- description: string; [[Action description]]
+ description: string @nullable; [[Action description, or $null if the action
+ has none.]]
}
keys {
id: int; [[ID to set or get description for]]
@@ -63,7 +65,9 @@ mixin @beta Efl.Access.Action
params {
@in id: int; [[ID for widget]]
}
- return: mstring @move @no_unused; [[Should be freed by the user.]]
+ return: mstring @move @no_unused @nullable; [[The keybinding, or $null if
+ the action has none. Should be
+ freed by the user.]]
}
}
}
diff --git a/src/lib/elementary/efl_access_object.eo b/src/lib/elementary/efl_access_object.eo
index d077eaa481..8edc0fcdd2 100644
--- a/src/lib/elementary/efl_access_object.eo
+++ b/src/lib/elementary/efl_access_object.eo
@@ -260,7 +260,7 @@ mixin @beta Efl.Access.Object requires Efl.Object
set {
}
values {
- i18n_name: string; [[Accessible name]]
+ i18n_name: string @nullable; [[Accessible name, or $null if the object has none.]]
}
}
relations_get @protected @beta @const {
diff --git a/src/lib/elementary/efl_access_text.eo b/src/lib/elementary/efl_access_text.eo
index b40dc1a4eb..55ae025839 100644
--- a/src/lib/elementary/efl_access_text.eo
+++ b/src/lib/elementary/efl_access_text.eo
@@ -84,7 +84,8 @@ interface @beta Efl.Access.Text
end_offset: int; [[End offset of text.]]
}
values {
- text: mstring @move; [[UTF-8 encoded text.]]
+ text: mstring @move @nullable; [[UTF-8 encoded text, or $null if the range
+ could not be read.]]
}
}
@property caret_offset @protected @beta {
diff --git a/src/lib/elementary/efl_config_global.eo b/src/lib/elementary/efl_config_global.eo
index 5c19e7072d..230109a269 100644
--- a/src/lib/elementary/efl_config_global.eo
+++ b/src/lib/elementary/efl_config_global.eo
@@ -50,7 +50,7 @@ class @beta Efl.Config_Global extends Efl.Object implements Efl.Config
hidden: bool @optional; [[If $true, gets the full list of profiles,
including those stored in hidden files.]]
}
- return: iterator<string> @move; [[Iterator to profiles]]
+ return: iterator<string> @move @nullable; [[Iterator to profiles, or $null if there are none.]]
}
profile_exists {
[[Returns whether a profile exists or not.]]
diff --git a/src/lib/elementary/efl_ui_dnd.eo b/src/lib/elementary/efl_ui_dnd.eo
index 2b00b9ca52..9517a92f1f 100644
--- a/src/lib/elementary/efl_ui_dnd.eo
+++ b/src/lib/elementary/efl_ui_dnd.eo
@@ -49,7 +49,7 @@ mixin @beta Efl.Ui.Dnd requires Efl.Object {
@in action: string; [[Requested action to perform by the receiver once content is transferred.]]
@in seat: uint; [[Seat starting the drag operation. When in doubt use 0.]]
}
- return : Efl.Content; [[An Efl.Ui element which you can use to render a visual representation
+ return : Efl.Content @nullable; [[An Efl.Ui element which you can use to render a visual representation
of the content being dragged (like a thumbnail, for example).
Use @Efl.Content.content.set on it to do so.]]
}
diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo
index 080edaaf7a..b7e0cc2fef 100644
--- a/src/lib/elementary/efl_ui_focus_manager.eo
+++ b/src/lib/elementary/efl_ui_focus_manager.eo
@@ -47,18 +47,22 @@ interface Efl.Ui.Focus.Manager {
params {
direction : Efl.Ui.Focus.Direction; [[The direction to move to.]]
}
- return : Efl.Ui.Focus.Object; [[The element which is now focused.]]
+ return : Efl.Ui.Focus.Object @nullable; [[The element which is now focused, or
+ $null if the manager does not cycle and
+ there was nothing further to move to.]]
}
request_move {
[[Returns the object in the $direction from $child.]]
params {
direction : Efl.Ui.Focus.Direction; [[Direction to move focus.]]
- child : Efl.Ui.Focus.Object; [[The child to move from.
+ child : Efl.Ui.Focus.Object @nullable; [[The child to move from.
Pass $null to indicate the currently focused child.]]
logical : bool; [[Wether you want to have a logical node as result or a regular.
Note that in a @.move call logical nodes will not get focus.]]
}
- return : Efl.Ui.Focus.Object; [[Object that would receive focus if moved in the given direction.]]
+ return : Efl.Ui.Focus.Object @nullable; [[Object that would receive focus if moved
+ in the given direction, or $null if
+ nothing would.]]
}
@property manager_focus {
[[The element which is currently focused by this manager.
@@ -69,8 +73,17 @@ interface Efl.Ui.Focus.Manager {
object is selected instead. If there is no such object, focus does not change.
]]
- values {
- focus : Efl.Ui.Focus.Object; [[Currently focused element.]]
+ set {
+ values {
+ focus : Efl.Ui.Focus.Object; [[Element to focus. Not $null --
+ there is no "focus nothing" here.]]
+ }
+ }
+ get {
+ values {
+ focus : Efl.Ui.Focus.Object @nullable; [[Currently focused element,
+ or $null if nothing is.]]
+ }
}
}
@property redirect {
@@ -126,11 +139,16 @@ interface Efl.Ui.Focus.Manager {
]]
set {
return : bool; [[$true on success, $false if it had already been set.]]
+ values {
+ root : Efl.Ui.Focus.Object; [[Object to register as the root of this
+ manager object. Not $null.]]
+ }
}
- get {}
-
- values {
- root : Efl.Ui.Focus.Object; [[Object to register as the root of this manager object.]]
+ get {
+ values {
+ root : Efl.Ui.Focus.Object @nullable; [[The root of this manager object,
+ or $null if none has been set.]]
+ }
}
}
request_subchild {
@@ -143,7 +161,8 @@ interface Efl.Ui.Focus.Manager {
params {
root : Efl.Ui.Focus.Object; [[Parent for returned child.]]
}
- return : Efl.Ui.Focus.Object; [[Child of passed parameter.]]
+ return : Efl.Ui.Focus.Object @nullable; [[Child of passed parameter, or $null if
+ it has none.]]
}
fetch @beta {
[[Fetches the data from a registered node.
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.eo b/src/lib/elementary/efl_ui_focus_manager_calc.eo
index d7f9124fe8..45bbac52ff 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.eo
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.eo
@@ -15,7 +15,7 @@ class @beta Efl.Ui.Focus.Manager_Calc extends Efl.Object implements Efl.Ui.Focus
params {
child : Efl.Ui.Focus.Object; [[The object to register.]]
parent : Efl.Ui.Focus.Object; [[The parent to use in the logical tree.]]
- redirect : Efl.Ui.Focus.Manager; [[The redirect manager to set once this child is focused.
+ redirect : Efl.Ui.Focus.Manager @nullable; [[The redirect manager to set once this child is focused.
Can be $NULL for no redirect.]]
}
return : bool; [[$true if successful, $false otherwise.]]
@@ -29,7 +29,7 @@ class @beta Efl.Ui.Focus.Manager_Calc extends Efl.Object implements Efl.Ui.Focus
params {
child : Efl.Ui.Focus.Object; [[The object to register.]]
parent : Efl.Ui.Focus.Object; [[The parent to use in the logical tree.]]
- redirect : Efl.Ui.Focus.Manager; [[The redirect manager to set once this child is focused.
+ redirect : Efl.Ui.Focus.Manager @nullable; [[The redirect manager to set once this child is focused.
Can be $NULL for no redirect.]]
}
return : bool; [[$true if successful, $false otherwise.]]
diff --git a/src/lib/elementary/efl_ui_focus_object.eo b/src/lib/elementary/efl_ui_focus_object.eo
index 2de9620c3c..58beae1f8e 100644
--- a/src/lib/elementary/efl_ui_focus_object.eo
+++ b/src/lib/elementary/efl_ui_focus_object.eo
@@ -39,14 +39,16 @@ mixin Efl.Ui.Focus.Object
]]
get {}
values {
- manager : Efl.Ui.Focus.Manager; [[The manager object.]]
+ manager : Efl.Ui.Focus.Manager @nullable; [[The manager object, or $null if this
+ object is not registered with one.]]
}
}
@property focus_parent {
[[The logical parent used by this object.]]
get {}
values {
- logical_parent : Efl.Ui.Focus.Object; [[The focus parent.]]
+ logical_parent : Efl.Ui.Focus.Object @nullable; [[The focus parent, or $null if this
+ object is not registered with a manager.]]
}
}
@property child_focus @protected {
diff --git a/src/lib/elementary/efl_ui_format.eo b/src/lib/elementary/efl_ui_format.eo
index e711537492..9dda4dc76e 100644
--- a/src/lib/elementary/efl_ui_format.eo
+++ b/src/lib/elementary/efl_ui_format.eo
@@ -79,7 +79,8 @@ mixin Efl.Ui.Format requires Efl.Object
performance reasons.
]]
values {
- values: accessor<Efl.Ui.Format_Value> @move; [[Accessor over a list of value-text pairs.
+ values: accessor<Efl.Ui.Format_Value> @move @nullable; [[Accessor over a list of value-text pairs,
+ or $null for none.
The method will dispose of the accessor, but not of
its contents.
For convenience, Eina offers a range of helper
diff --git a/src/lib/elementary/efl_ui_relative_container.eo b/src/lib/elementary/efl_ui_relative_container.eo
index e48dcf70c8..6c742537f1 100644
--- a/src/lib/elementary/efl_ui_relative_container.eo
+++ b/src/lib/elementary/efl_ui_relative_container.eo
@@ -21,7 +21,7 @@ class Efl.Ui.Relative_Container extends Efl.Ui.Widget implements Efl.Pack_Layout
being changed.]]
}
values {
- base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
+ base: Efl.Gfx.Entity @nullable; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(0.0); [[The ratio between left and right of the base,
@@ -40,7 +40,7 @@ class Efl.Ui.Relative_Container extends Efl.Ui.Widget implements Efl.Pack_Layout
being changed.]]
}
values {
- base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
+ base: Efl.Gfx.Entity @nullable; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(1.0); [[The ratio between left and right of the base,
@@ -59,7 +59,7 @@ class Efl.Ui.Relative_Container extends Efl.Ui.Widget implements Efl.Pack_Layout
being changed.]]
}
values {
- base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
+ base: Efl.Gfx.Entity @nullable; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(0.0); [[The ratio between top and bottom of the base,
@@ -78,7 +78,7 @@ class Efl.Ui.Relative_Container extends Efl.Ui.Widget implements Efl.Pack_Layout
being changed.]]
}
values {
- base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
+ base: Efl.Gfx.Entity @nullable; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(1.0); [[The ratio between top and bottom of the base,
diff --git a/src/lib/elementary/efl_ui_view_model.eo b/src/lib/elementary/efl_ui_view_model.eo
index 6d07f8d101..823d699609 100644
--- a/src/lib/elementary/efl_ui_view_model.eo
+++ b/src/lib/elementary/efl_ui_view_model.eo
@@ -45,9 +45,9 @@ class Efl.Ui.View_Model extends Efl.Composite_Model
params {
name: string; [[The name for the new synthetic property.]]
definition: string; [[The definition string for the new synthetic property.]]
- not_ready: string; [[The text to be used if any of the properties used in $definition is not ready yet.
+ not_ready: string @nullable; [[The text to be used if any of the properties used in $definition is not ready yet.
If set to $null, no check against EAGAIN will be done.]]
- on_error: string; [[The text to be used if any of the properties used in $definition is in error. It takes
+ on_error: string @nullable; [[The text to be used if any of the properties used in $definition is in error. It takes
precedence over $not_ready. If set to $null, no error checks are performed.]]
}
return: Eina.Error;
diff --git a/src/lib/elementary/efl_ui_widget_scrollable_content.eo b/src/lib/elementary/efl_ui_widget_scrollable_content.eo
index 82de9eae00..e5d0e14448 100644
--- a/src/lib/elementary/efl_ui_widget_scrollable_content.eo
+++ b/src/lib/elementary/efl_ui_widget_scrollable_content.eo
@@ -50,7 +50,8 @@ mixin Efl.Ui.Widget_Scrollable_Content requires Efl.Object
}
get {}
values {
- content: Efl.Canvas.Object; [[The content object.]]
+ content: Efl.Canvas.Object @nullable; [[The content object, or $null if this widget
+ is showing text rather than content.]]
}
}
@property scrollable_text {
@@ -68,7 +69,8 @@ mixin Efl.Ui.Widget_Scrollable_Content requires Efl.Object
get {
}
values {
- text: string; [[Text string to display on it.]]
+ text: string @nullable; [[Text string to display on it, or $null if this widget
+ is showing content rather than text.]]
}
}
}
diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo
index 82b3daf446..eb5ba562eb 100644
--- a/src/lib/eo/efl_object.eo
+++ b/src/lib/eo/efl_object.eo
@@ -98,7 +98,8 @@ abstract Efl.Object
get {
}
values {
- parent: Efl.Object @nullable; [[The new parent.]]
+ parent: Efl.Object @nullable; [[The new parent, or $null to detach the object
+ from the tree and leave it without one.]]
}
}
@property name {
@@ -115,7 +116,7 @@ abstract Efl.Object
get {
}
values {
- name: string @nullable; [[The name.]]
+ name: string @nullable; [[The name, or $null if the object has none.]]
}
}
@property comment {
@@ -130,7 +131,7 @@ abstract Efl.Object
get {
}
values {
- comment: string; [[The comment.]]
+ comment: string @nullable; [[The comment, or $null for none.]]
}
}
debug_name_override {
@@ -220,7 +221,8 @@ abstract Efl.Object
params {
klass : const(Efl.Class); [[The class identifier to search for.]]
}
- return : Efl.Object @nullable; [[Object from the provider list.]]
+ return : Efl.Object @nullable; [[Object from the provider list, or $null if no
+ provider for that class was found.]]
}
constructor {
[[Implement this method to provide optional initialization code for your object.
diff --git a/src/lib/evas/canvas/efl_canvas_group.eo b/src/lib/evas/canvas/efl_canvas_group.eo
index 353ec255fe..6ca26ceb7c 100644
--- a/src/lib/evas/canvas/efl_canvas_group.eo
+++ b/src/lib/evas/canvas/efl_canvas_group.eo
@@ -57,8 +57,8 @@ class Efl.Canvas.Group extends Efl.Canvas.Object implements Efl.Gfx.Filter
from both the @Efl.Object children list as well as the @Efl.Container
content list.
]]
- return: iterator<Efl.Canvas.Object> @move;
- [[Iterator to object children]]
+ return: iterator<Efl.Canvas.Object> @move @nullable;
+ [[Iterator over the group members, or $null if the group has none.]]
}
group_member_add {
[[Set a canvas object as a member of a given group (or smart object).
diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo
index c54910c249..bb2f085124 100644
--- a/src/lib/evas/canvas/efl_canvas_object.eo
+++ b/src/lib/evas/canvas/efl_canvas_object.eo
@@ -130,7 +130,7 @@ abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity,
get {
}
values {
- clipper: Efl.Canvas.Object; [[The object to clip $obj by.]]
+ clipper: Efl.Canvas.Object @nullable; [[The object to clip $obj by, or $null for none.]]
}
}
@property has_fixed_size @beta {
diff --git a/src/lib/evas/canvas/efl_canvas_object_animation.eo b/src/lib/evas/canvas/efl_canvas_object_animation.eo
index 5059733d00..be119b57b6 100644
--- a/src/lib/evas/canvas/efl_canvas_object_animation.eo
+++ b/src/lib/evas/canvas/efl_canvas_object_animation.eo
@@ -15,7 +15,8 @@ mixin Efl.Canvas.Object_Animation requires Efl.Object
}
values {
- animation : Efl.Canvas.Animation; [[The animation which is currently applied on this object.]]
+ animation : Efl.Canvas.Animation @nullable; [[The animation currently applied on this
+ object, or $null if there is none.]]
}
}
@property animation_progress {
diff --git a/src/lib/evas/canvas/efl_input_device.eo b/src/lib/evas/canvas/efl_input_device.eo
index dda39b1877..8b78a622aa 100644
--- a/src/lib/evas/canvas/efl_input_device.eo
+++ b/src/lib/evas/canvas/efl_input_device.eo
@@ -53,7 +53,8 @@ class Efl.Input.Device extends Efl.Object
]]
get {}
values {
- seat: Efl.Input.Device; [[The seat this device belongs to.]]
+ seat: Efl.Input.Device @nullable; [[The seat this device belongs to, or $null if
+ it belongs to none.]]
}
}
@property seat_id {
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index e7681208c7..673ef033d5 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -1040,6 +1040,9 @@ class Function(Object):
def return_is_by_ref(self, ftype):
return bool(lib.eolian_function_return_is_by_ref(self, ftype))
+ def return_is_nullable(self, ftype):
+ return bool(lib.eolian_function_return_is_nullable(self, ftype))
+
def return_is_move(self, ftype):
return bool(lib.eolian_function_return_is_move(self, ftype))
@@ -1093,6 +1096,10 @@ class Function_Parameter(Object):
def is_optional(self):
return bool(lib.eolian_parameter_is_optional(self))
+ @property
+ def is_nullable(self):
+ return bool(lib.eolian_parameter_is_nullable(self))
+
@cached_property
def is_by_ref(self):
return bool(lib.eolian_parameter_is_by_ref(self))
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 712a51926d..4ea7714e88 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -434,6 +434,14 @@ lib.eolian_parameter_documentation_get.restype = c_void_p
lib.eolian_parameter_is_optional.argtypes = (c_void_p,)
lib.eolian_parameter_is_optional.restype = c_bool
+# EAPI Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc);
+lib.eolian_parameter_is_nullable.argtypes = (c_void_p,)
+lib.eolian_parameter_is_nullable.restype = c_bool
+
+# EAPI Eina_Bool eolian_function_return_is_nullable(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
+lib.eolian_function_return_is_nullable.argtypes = (c_void_p, c_int)
+lib.eolian_function_return_is_nullable.restype = c_bool
+
# Eolian_Implement ##########################################################
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 6745467018..30d84e7325 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -3,3 +3,17 @@ master_timeout = 240
# gets to say which test case was still running. See src/tests/timeout.c.
executable('timeout', 'timeout.c',
c_args: '-DEFL_TEST_MASTER_TIMEOUT=@0@'.format(master_timeout))
+
+# The checks that keep the .eo files honest. They read the source tree rather
+# than the build, so they run from the project root.
+python3_prog = find_program('python3', required: false)
+
+if python3_prog.found()
+ # Slower than the other lints: it reads every implementation body in the
+ # tree to find out what C actually does about NULL.
+ test('check-nullable', python3_prog,
+ args: [join_paths(meson.project_source_root(), 'scripts', 'check-nullable.py')],
+ workdir: meson.project_source_root(),
+ suite: 'lint',
+ timeout: 600)
+endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.