freefunc - name clash with Python.h

Hal Murray hmurray at megapathdsl.net
Sun Jun 14 04:46:19 UTC 2020


Does my test program do anything interesting on your system?

rsalz at akamai.com said:
> I dlon't lnow about Python's freefunc, no idea what it is, but the OpenSSL
> line is defining a function with a local parameter named freefunc. Those
> names shouldn't clash; what compiler and flags?

Python has:
typedef void (*freefunc)(void *);

That looks weird to me, but I'm not a language guy.

$ cc --version
cc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1)
(Fedora)

cc -Wshadow -I/usr/include/python3.8 -I/usr/local/ssl/include -o 
freefunc-shadow freefunc-shadow.c


> Can you switch the include order?

That solves my problem.  I was assuming this should get sorted out before release so other users don't get confused.

There are 24 warnings, 535 lines.  Here is everything from the last one.

/usr/local/ssl/include/openssl/safestack.h:124:72: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]
  124 |                                        sk_##t1##_freefunc freefunc) \
      |                                        ~~~~~~~~~~~~~~~~~~~^~~~~~~~

/usr/local/ssl/include/openssl/safestack.h:135:29: note: in expansion of macro ‘SKM_DEFINE_STACK_OF’
  135 | # define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t)
      |                             ^~~~~~~~~~~~~~~~~~~
/usr/local/ssl/include/openssl/safestack.h:175:40: note: in expansion of macro ‘DEFINE_STACK_OF’
  175 | # define DEFINE_OR_DECLARE_STACK_OF(s) DEFINE_STACK_OF(s)
      |                                        ^~~~~~~~~~~~~~~
/usr/local/ssl/include/openssl/asn1.h:591:1: note: in expansion of macro ‘DEFINE_OR_DECLARE_STACK_OF’
  591 | DEFINE_OR_DECLARE_STACK_OF(ASN1_GENERALSTRING)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.8/pytime.h:6,
                 from /usr/include/python3.8/Python.h:85,
                 from freefunc-shadow.c:9:
/usr/include/python3.8/object.h:156:16: note: shadowed declaration is here
  156 | typedef void (*freefunc)(void *);
      |                ^~~~~~~~


Looking closer, there are 12 repeated pairs.

... | grep warning

/usr/local/ssl/include/openssl/safestack.h:90:97: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]
/usr/local/ssl/include/openssl/safestack.h:124:72: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]
/usr/local/ssl/include/openssl/safestack.h:90:97: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]
/usr/local/ssl/include/openssl/safestack.h:124:72: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]
...
/usr/local/ssl/include/openssl/safestack.h:90:97: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]
/usr/local/ssl/include/openssl/safestack.h:124:72: warning: declaration of ‘freefunc’ shadows a global declaration [-Wshadow]


-- 
These are my opinions.  I hate spam.





More information about the openssl-users mailing list