[PATCH] gcc: vx-common.h: fix test for VxWorks7

Rasmus Villemoes rasmus.villemoes@prevas.dk
Fri Nov 5 21:26:19 GMT 2021


On 05/11/2021 16.12, Olivier Hainque wrote:
> 
> 
>> On 5 Nov 2021, at 15:12, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:

> We happen to also have a few fixincludes hunks around. Some of
> them have been there for years now and I thought would be nice to
> propagate at some point.
> 
> Do you use it?

Sort of, kind of. I have previously sent fixups for some of the vxworks
fixincludes, and I think I have a few more I could submit, but since I'm
able to modify our target headers directly that's often much easier.

For example, there's the mkdir fixup that adds

    #define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))

But that macro doesn't play well with code in libstdc++ that says

    if (posix::mkdir(p.c_str(), mode))

because that expands to utter nonsense and breaks the build. A better
macro, also using the comma operator to have the mode argument evaluated
then ignored, would be something like

  #define mkdir(dir, mode) mkdir(((void)(mode), (dir)))

(or the variadic version to continue allowing a one-argument
invocation). But it was easier to just change the target header, making
that fixinclude pattern no longer apply - knowing that if we ever
compile the mkdir implementation [we have parts of the kernel sources,
but not all], we'll have to fixup the definition.

The one fixinclude-related problem I have is the stdint.h one I've
mentioned previously.

Rasmus


More information about the Gcc-patches mailing list