Commit 28397a6
committed
Merge branch 'dscho/gcc-8-gfw-fixups'
Turns out that my fix was *not* good, as I cast a function pointer to a
data pointer, and then back to a different function pointer, in an
attempt to shut up GCC 8.x.
But a cast between a function pointer and a data pointer is actually not
allowed. It just happens to work on many CPUs, but maybe in the future
we will all have CPUs that are safer and really have separate memory for
code than for data (which would however break JITs).
In any case, the cast's purpose was to avoid the warning by saying "yes,
we know, this is a different pointer, but we know what we're doing,
let's cast to `(void *)` as a generic pointer and then further to the
one we know is the correct type". This works for data pointers of
different types.
For function pointers, the equivalent of `void *` is `void (*)(void)`.
So let's use that instead.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>2 files changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
0 commit comments