Skip to content

Commit

Permalink
coding standard: add optee_client clause on { 0 } initializer
Browse files Browse the repository at this point in the history
Optee_client package expects { 0 } initializer when instance 1st field
is a scalar. See rational from [1].

Link: [1] OP-TEE/optee_client#230 (comment)
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
etienne-lms authored and jbech-linaro committed Apr 14, 2021
1 parent 34bea56 commit 0592f4c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions general/coding_standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Variables are initialized according to these general guidelines:
* Scalars (and types like ``time_t`` which are standardized as scalars)
are initialized with ``0``, unless another value makes more sense.

* For optee_client we need maximum portability. So only initialize
struct types (and ``pthread_t``) with ``memset()`` unless there is a
good reason not to do so.
* For optee_client_ we need maximum portability. So use ``{ 0 }`` for
struct types where the first element is known to be a scalar and
``memset()`` otherwise unless there is a good reason not to do so.

* For the rest of the gits we assume that a recent version of GCC or
Clang is used so we initialize structs with ``{ }`` in order to avoid
Expand All @@ -57,4 +57,5 @@ There are also targets for common use cases in the Makefiles:
.. _checkpatch script: https://github.com/OP-TEE/optee_os/blob/master/scripts/checkpatch.sh
.. _checkpatch: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl
.. _CodingStyle: https://www.kernel.org/doc/html/latest/process/coding-style.html
.. _optee_client: https://github.com/OP-TEE/optee_client
.. _repository-structure: fixme::after-sphinks-updates

0 comments on commit 0592f4c

Please sign in to comment.