Re: [PATCH v3 2/2] lazyload.h: use an even more generic function pointer than FARPROC

2 messages, 2 authors, 2021-09-27 · open the first message on its own page

Re: [PATCH v3 2/2] lazyload.h: use an even more generic function pointer than FARPROC

From: Junio C Hamano <hidden>
Date: 2021-09-27 16:35:51

Carlo Marcelo Arenas Belón  [off-list ref] writes:
gcc will helpfully raise a -Wcast-function-type warning when casting
between functions that might have incompatible return types
(ex: GetUserNameExW returns bool which is only half the size of the
return type from FARPROC which is long long), so create a new type that
could be used as a completely generic function pointer and cast through
it instead.

Because of the way the function declaration was done in the previous
patch the order of variables that use it had to be adjusted so that
it is the last variable declared, as well.
Is it clear to everybody what this paragraph is referring to?  It is
not, at least to me.
Additionaly remove the -Wno-incompatible-pointer-types temporary
flag added in 27e0c3c (win32: allow building with pedantic mode
enabled, 2021-09-03), as it will be no longer needed.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
---
v3
- removes unnecessary variable moving after fixup in previous patch
Thanks.

Re: [PATCH v3 2/2] lazyload.h: use an even more generic function pointer than FARPROC

From: Carlo Arenas <hidden>
Date: 2021-09-27 18:51:02

On Mon, Sep 27, 2021 at 9:35 AM Junio C Hamano [off-list ref] wrote:
Carlo Marcelo Arenas Belón  [off-list ref] writes:
quoted
Because of the way the function declaration was done in the previous
patch the order of variables that use it had to be adjusted so that
it is the last variable declared, as well.
Is it clear to everybody what this paragraph is referring to?  It is
not, at least to me.
It is not, and it is no longer needed after the fixup was applied to
the previous
patch.  Do you want me to send another series removing it or can be done
while applying?

It was slightly better explained in the fixup[1] commit message.

Because of the double ';', When the macro was used to declare a
function variable
and it was not the last variable declared, then it will trigger
-Wdeclaration-after-statement.

Carlo

[1] https://lore.kernel.org/git/3f963bba-3197-8c52-9828-6d78ef1d25b1@kdbg.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help