Skip to content

Commit 2b7a27e

Browse files
pabigotnashif
authored andcommitted
doc: clarify api design guidelines for optional API
There has been discussion about whether invocations of optional API that has been disabled should: 1. result in a link-time error because the API implementation is not provided; or 2. result in a run-time error by having a trivial implementation that returns -ENOTSUP. Clarify that the intent of the guideline is that a link-time error should be produced. The rationale is that it is too easy to disable the option at build time, and not discover it because the application fails to check for a `-ENOTSUP` return. Signed-off-by: Peter Bigot <[email protected]>
1 parent 7223154 commit 2b7a27e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/guides/design_guidelines.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ practices should be followed.
8787
enabled should be provided unconditionally. Add a note in the
8888
description that the function is available only when the specified
8989
feature is enabled, referencing the required Kconfig symbol by name.
90-
(In cases where the function is used but not enabled a link-time error
91-
will be generated.)
90+
In the cases where the function is used but not enabled the definition
91+
of the function shall be excluded from compilation, so references to
92+
the unsupported API will result in a link-time error.
9293
* Where code specific to the feature is isolated in a source file that
9394
has no other content that file should be conditionally included in
9495
``CMakeLists.txt``::

0 commit comments

Comments
 (0)