On 06/21/2012 09:40 PM, Hans-Peter Nilsson wrote:
On Wed, 20 Jun 2012, rbmj wrote:
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.
Beware, if you go this route, I think you need to evaluate the
"mode" argument (b above), i.e. something like "#define mkdir(a,
b) ((b), (mkdir) (a))".


Yes, you're correct. I think then that this makes the normal macro a better option than the variadic macro, even though the variadic is more compatible. Wrapping the mkdir macro in IN_GCC should provide an adequate guard to prevent the macro from expanding in code that relies on the non-compliant signature.

I would ask who in the world puts expressions with side effects in as the mode argument and then relies on those side effects for something other than the (ignored) mode, but I know better :-P.

I think this is better than the previous solution as it doesn't require touching GCC itself per-se, and instead deals with header incompatibilities where they should be dealt with in fixincludes. I'll write up a patch and put that with the other fixincludes patches I've submitted.

Thanks,

Robert

Reply via email to