diff options
author | Rasmus Villemoes <rv@rasmusvillemoes.dk> | 2018-09-03 15:26:45 +0200 |
---|---|---|
committer | Rasmus Villemoes <villemoes@gcc.gnu.org> | 2018-09-03 13:26:45 +0000 |
commit | c7a8f93d7b2132ed163a2d80fc06b36792042893 (patch) | |
tree | 49ccf009f7aa408cd69d01f9e0aba20ffc63c707 /fixincludes/ChangeLog | |
parent | c98c243078c380ad4c9a1ef08869d3b64abb128f (diff) | |
download | gcc-c7a8f93d7b2132ed163a2d80fc06b36792042893.zip gcc-c7a8f93d7b2132ed163a2d80fc06b36792042893.tar.gz gcc-c7a8f93d7b2132ed163a2d80fc06b36792042893.tar.bz2 |
fixincludes: vxworks: remove unnecessary parentheses in ioctl wrapper macro
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
Diffstat (limited to 'fixincludes/ChangeLog')
-rw-r--r-- | fixincludes/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 03b459c3..4f5f1fe 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,9 @@ +2018-09-03 Rasmus Villemoes <rv@rasmusvillemoes.dk> + + * inclhack.def (vxworks_ioctl_macro): Remove parentheses from + expansion of ioctl macro. + * fixincl.x: Regenerate. + 2018-07-23 David Edelsohn <dje.gcc@gmail.com> * inclhack.def (aix_unistd): New. |