[PATCH] eng: Clarify use of extern "C"

Joel Sherrill joel at rtems.org
Mon Jan 23 14:01:00 UTC 2023


Following that comment precisely means we should remove them if there are
no functions. That ignores data items and the simple maintenance issue of
not having an extern C, adding something in the future and forgetting to
add extern C.

IMO it's just part of the header file template we should always use.
Deciding when it is absolutely not needed is going to introduce latent
issues.

On Mon, Jan 23, 2023, 3:57 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Close #4806.
> ---
>  eng/coding-file-hdr.rst | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/eng/coding-file-hdr.rst b/eng/coding-file-hdr.rst
> index 3167670..e6f5b30 100644
> --- a/eng/coding-file-hdr.rst
> +++ b/eng/coding-file-hdr.rst
> @@ -98,6 +98,9 @@ Use the following guidelines and template for C and C++
> header files (here
>
>  * For C++ header files discard the ``extern "C"`` start and end sections.
>
> +* The ``extern "C"`` is only required if the C header file contains
> function
> +  declarations or inline function definitions.
> +
>  .. code-block:: c
>
>      /* SPDX-License-Identifier: BSD-2-Clause */
> --
> 2.35.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230123/edadc239/attachment-0001.htm>


More information about the devel mailing list