libc functions from c++ issues

Joel Sherrill joel at rtems.org
Thu Apr 14 03:51:01 UTC 2022


On Wed, Apr 13, 2022, 9:14 PM Chris Johns <chrisj at rtems.org> wrote:

> On 14/4/2022 6:58 am, Joel Sherrill wrote:
> > When you use -std= with gcc, it says to strictly enforce that standard.
> C++ is
> > NOT POSIX so pthread.h prototypes aren't visible.  There are some edge
> cases
> > where gcc isn't that strict until -pedantic is turned on. Use of long
> long in
> > C++03 is an example of that.
> >
> > -D_POSIX_C_SOURCE=200809 is precisely the answer I think but
> -D_GNU_SOURCE
> > enables almost everything I think.
> >
> > Anyway, here's a small Makefile with some comments to help:
>
> Nice and thanks. I reviewed the flags on this page:
>
> https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
>
> And adding `_XOPEN_SOURCE` to the compiler command line allowed the code to
> build. I will raise the strict vs non-strict issue with the project. I
> suspect
> they are not aware there is an issue.
>

One thing I've learned from working the FACE Technical Standard is that it
is common to think you are closely following a standard but the tools and
environment don't enforce it like you think.

When you get the warnings down (assume there are some/lots), turn on -Wall
and -pedantic and see where else the code isn't strictly following things.




> Chris
>


More information about the devel mailing list