freefunc - name clash with Python.h
Dr. Matthias St. Pierre
Matthias.St.Pierre at ncp-e.com
Sun Jun 14 09:54:28 UTC 2020
> Does my test program do anything interesting on your system?
No. Except for compiling with warnings ;-)
> Python has:
> typedef void (*freefunc)(void *);
>
> That looks weird to me, but I'm not a language guy.
That's simply a C type definition for a pointer type named `freefunc`, which can hold the address of any function
`foo` which has the signature `void foo(void *)`. This pointer type is used in various locations by python:
https://github.com/python/cpython/search?p=2&q=freefunc
So Python's global typedef has the same name as a function argument in our headers. The only potential
problem I see here that within one of our functions which has `freefunc` as an argument name, the
global `freefunc` type name would not be available.
You can safely ignore this warning. (Either omit `-Wshadow` entirely, or disable it locally using a #pragma.)
> No problems on 1.1.1g from Fedora.
I was able to trace back the warning to commit 739a1eb1961cdc3b1597a040766f3cb359d095f6 from 2016,
which is included in OpenSSL Versions 1.1.0 and higher. So you should get the warning in 1.1.1g too, unless
Fedora patched the source code.
https://github.com/openssl/openssl/commit/739a1eb1961cdc3b1597a040766f3cb359d095f6
I don't see any reason to change our code, IMHO the clash is Python's fault: it declares a global typedef
with a short name that has no python-specific prefix.
HTH,
Matthias
More information about the openssl-users
mailing list