On 06/12/2012 08:16 AM, rbmj wrote:
On 06/11/2012 08:01 AM, Paolo Bonzini wrote:
VxWorks should define TARGET_POSIX_IO if it has both access and
mkdir. Please add it to gcc/config/vxworks.h if this is the case.
I misspoke in my earlier email - sorry for my lack of attention to
detail. The issue is that
VxWorks does *not* have a two argument mkdir(). It does have
TARGET_POSIX_IO. Undefing TARGET_POSIX_IO seems non-optimal as it
disables some functionality that can still be implemented, just
omitting the mode argument. With this in mind, I defined
MKDIR_SINGLE_ARG in gcc/config/vxworks.h, and then added a check for
this define. This is a slightly less ugly solution than I had earlier.
An updated patch is attached. It's in git format-patch format, so the
commit message is at the top.
There is an alternate solution- I could use fixincludes to add a macro
to wrap over mkdir on VxWorks. A couple of possible ways to do this:
1. Define a normal macro to posix-ify it, i.e. #define mkdir(a, b)
((mkdir)(a)). Since this would hide single-argument mkdir, it would
probably be best to wrap it in #ifdef IN_GCC in order to avoid breaking
existing vxWorks code.
2. Make a variadic macro to allow for posix compatibility, i.e. #define
mkdir(a, ...) ((mkdir)(a)). I'm not sure if this works outside of C99
mode - I know GCC supports it as an extension in C89 mode, but AFAIK the
semantics are slightly different. I'm also not sure about g++. This
does have the advantage though that it doesn't break any existing code.
However, it does allow nonsensical 20 argument mkdir as well.
Either of these or the one in my previous email should work. Which (or
a different one entirely) would be preferred?
Thanks,
Robert