Duy Nguyen <[email protected]> writes:
>> The disadvantage, of course, would be that other call sites would not
>> benefit from a manual auditing whether the argument has side effects (and
>> thus, whether a macro using the argument multiple times would result in
>> very unexpected multiple side effects).
>
> That's just a better reason to "fix" it in compat/. If you define a
> git_fileno() function and map fileno to it, then you won't have to
> deal with side effects of FreeBSD's fileno() macro. All evaluation
> happens before git_fileno() is called.
Hmph, so the idea is to have
/* do not include git-compat-util.h here */
int wrapped_fileno(FILE *f)
{
return fileno(f);
}
in compat/fileno.c and then do something like this
#ifdef fileno
#undef fileno
#define fileno(x) wrapped_fileno(x)
#endif
for FreeBSD in git-compat-util.h or something like that?
I think I can buy that.