The rationale for the fixinclude ioctl macro wrapper is, as far as I can tell (https://gcc.gnu.org/ml/gcc-patches/2012-09/msg01619.html) Fix 2: Add hack for ioctl() on VxWorks. ioctl() is supposed to be variadic, but VxWorks only has a three argument version with the third argument of type int. This messes up when the third argument is not implicitly convertible to int. This adds a macro which wraps around ioctl() and explicitly casts the third argument to an int. This way, the most common use case of ioctl (with a const char * for the third argument) will compile in C++, where pointers must be explicitly casted to int. However, we have existing C++ code that calls the ioctl function via ::ioctl(foo, bar, baz) and obviously this breaks when it gets expanded to ::(ioctl)(foo, bar, (int)(baz)) Since the GNU C preprocessor already prevents recursive expansion of function-like macros, the parentheses around ioctl are unnecessary. Incidentally, there is also a macro sioIoctl() in the vxworks sioLib.h header that expands to ((pSioChan)->pDrvFuncs->ioctl (pSioChan, cmd, arg)) which also breaks when that gets further expanded to ((pSioChan)->pDrvFuncs->(ioctl) (pSioChan, cmd, (int)(arg))) This patch partly fixes that issue as well, but the third argument to the pDrvFuncs->ioctl method should be void*, so the cast to (int) is slightly annoying. Internally, we've simply patched the sioIoctl macro: (((pSioChan)->pDrvFuncs->ioctl) (pSioChan, cmd, arg)) From-SVN: r264056
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
tests/base | Loading commit data... | |
ChangeLog | Loading commit data... | |
Makefile.in | Loading commit data... | |
README | Loading commit data... | |
README-fixinc | Loading commit data... | |
aclocal.m4 | Loading commit data... | |
check.tpl | Loading commit data... | |
config.h.in | Loading commit data... | |
configure | Loading commit data... | |
configure.ac | Loading commit data... | |
fixfixes.c | Loading commit data... | |
fixinc.in | Loading commit data... | |
fixincl.c | Loading commit data... | |
fixincl.tpl | Loading commit data... | |
fixincl.x | Loading commit data... | |
fixlib.c | Loading commit data... | |
fixlib.h | Loading commit data... | |
fixopts.c | Loading commit data... | |
fixtests.c | Loading commit data... | |
genfixes | Loading commit data... | |
inclhack.def | Loading commit data... | |
mkfixinc.sh | Loading commit data... | |
mkheaders.in | Loading commit data... | |
procopen.c | Loading commit data... | |
server.c | Loading commit data... | |
server.h | Loading commit data... | |
system.h | Loading commit data... |