devctl.h missing extern C

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

devctl.h missing extern C

Joel Sherrill
Hi

I noticed devctl.h is missing extern C. Does newlib have rules
on where they go? In stdio.h they were deeper in the file than
my normal style.

Obviously, I will be following up shortly with a patch.

Thanks.

--joel
Reply | Threaded
Open this post in threaded view
|

Re: devctl.h missing extern C

Brian Inglis
On 2020-02-10 09:10, Joel Sherrill wrote:

> I noticed devctl.h is missing extern C. Does newlib have rules
> on where they go? In stdio.h they were deeper in the file than
> my normal style.
>
> Obviously, I will be following up shortly with a patch.

Many headers now include _ansi.h which defines _{BEGIN,END}_STD_C and use those:
at the start after the include guard and setup (conditional) feature tests and
sets, and includes, before any functional declarations or definitions; and at
the end before SSP features tests and includes.

Others may have a __cplusplus test right after the include guard test, before
the include guard symbol definition; and the closing brace right before the
guard endif; otherwise as with the macros above.

You can get a sense of the usage with:

$ egrep -C3 __cplusplus newlib/**/include/**/*.h
$ egrep -C3 '_ansi\.h|_(BEGIN|END)_STD_C' newlib/**/include/**/*.h

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.