LudovicRousseau / pyscard

pyscard smartcard library for python
http://pyscard.sourceforge.net/
GNU Lesser General Public License v2.1
377 stars 108 forks source link

2.0.8: compile time warnings #164

Closed kloczek closed 3 months ago

kloczek commented 3 months ago

Your system information

Please describe your issue in as much detail as possible:

Looks like gcc 14.x shows some compile time warnings

```console + /usr/bin/python3 -sBm build -w --no-isolation * Getting build dependencies for wheel... running egg_info creating pyscard.egg-info writing pyscard.egg-info/PKG-INFO writing dependency_links to pyscard.egg-info/dependency_links.txt writing requirements to pyscard.egg-info/requires.txt writing top-level names to pyscard.egg-info/top_level.txt writing manifest file 'pyscard.egg-info/SOURCES.txt' reading manifest file 'pyscard.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '*.html' under directory 'smartcard/doc' warning: no files found matching '*.css' under directory 'smartcard/doc' warning: no files found matching '*.js' under directory 'smartcard/doc' warning: no files found matching '*.txt' under directory 'smartcard/doc' adding license file 'LICENSE' writing manifest file 'pyscard.egg-info/SOURCES.txt' * Building wheel... running bdist_wheel running build running build_py running build_ext building 'smartcard.scard._scard' extension swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i creating build creating build/temp.linux-x86_64-cpython-39 creating build/temp.linux-x86_64-cpython-39/smartcard creating build/temp.linux-x86_64-cpython-39/smartcard/scard /usr/bin/gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -g -fwrapv -O3 -Wall -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -DVER_PRODUCTVERSION=2,0,8,0000 -DVER_PRODUCTVERSION_STR=2.0.8 -DPCSCLITE=1 -Ismartcard/scard/ -I/usr/include/python3.9 -c smartcard/scard/helpers.c -o build/temp.linux-x86_64-cpython-39/smartcard/scard/helpers.o -I/usr/include/PCSC -pthread /usr/bin/gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -g -fwrapv -O3 -Wall -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -DVER_PRODUCTVERSION=2,0,8,0000 -DVER_PRODUCTVERSION_STR=2.0.8 -DPCSCLITE=1 -Ismartcard/scard/ -I/usr/include/python3.9 -c smartcard/scard/scard_wrap.c -o build/temp.linux-x86_64-cpython-39/smartcard/scard/scard_wrap.o -I/usr/include/PCSC -pthread smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardGetAttrib’: smartcard/scard/scard_wrap.c:4221:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4221 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardSetAttrib’: smartcard/scard/scard_wrap.c:4284:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4284 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardControl’: smartcard/scard/scard_wrap.c:4356:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4356 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardConnect’: smartcard/scard/scard_wrap.c:4525:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4525 | if (-1 == arg3) | ^~ smartcard/scard/scard_wrap.c:4530:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4530 | if (-1 == arg4) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardDisconnect’: smartcard/scard/scard_wrap.c:4571:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4571 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardEndTransaction’: smartcard/scard/scard_wrap.c:4604:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4604 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardEstablishContext’: smartcard/scard/scard_wrap.c:4637:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4637 | if (-1 == arg1) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardGetStatusChange’: smartcard/scard/scard_wrap.c:4674:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 4674 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardReconnect’: smartcard/scard/scard_wrap.c:5009:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 5009 | if (-1 == arg2) | ^~ smartcard/scard/scard_wrap.c:5014:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 5014 | if (-1 == arg3) | ^~ smartcard/scard/scard_wrap.c:5019:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘SCARDDWORDARG’ {aka ‘long unsigned int’} [-Wsign-compare] 5019 | if (-1 == arg4) | ^~ In file included from smartcard/scard/scard_wrap.c:3233: smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardTransmit’: smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:5206:12: note: declared here 5206 | BYTELIST temp4 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:5206:12: note: declared here 5206 | BYTELIST temp4 ; | ^~~~~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardStatus’: smartcard/scard/scard_wrap.c:5163:20: warning: ‘temp2.sz’ may be used uninitialized [-Wmaybe-uninitialized] 5163 | if(NULL!=arg2->sz) | ~~~~^~~~ smartcard/scard/scard_wrap.c:5074:10: note: ‘temp2’ declared here 5074 | STRING temp2 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp5’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:5077:12: note: declared here 5077 | BYTELIST temp5 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp5’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:5077:12: note: declared here 5077 | BYTELIST temp5 ; | ^~~~~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardControl’: smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4338:12: note: declared here 4338 | BYTELIST temp4 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4338:12: note: declared here 4338 | BYTELIST temp4 ; | ^~~~~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardGetAttrib’: smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp3’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4203:12: note: declared here 4203 | BYTELIST temp3 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp3’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4203:12: note: declared here 4203 | BYTELIST temp3 ; | ^~~~~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardListReaderGroups’: smartcard/scard/scard_wrap.c:4958:20: warning: ‘temp2.ac’ may be used uninitialized [-Wmaybe-uninitialized] 4958 | if(NULL!=arg2->ac) | ~~~~^~~~ smartcard/scard/scard_wrap.c:4899:14: note: ‘temp2’ declared here 4899 | STRINGLIST temp2 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp2’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4899:14: note: declared here 4899 | STRINGLIST temp2 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp2’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4899:14: note: declared here 4899 | STRINGLIST temp2 ; | ^~~~~ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardListReaders’: smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp3’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4750:14: note: declared here 4750 | STRINGLIST temp3 ; | ^~~~~ smartcard/scard/memlog.h:50:26: warning: ‘free’ called on unallocated object ‘temp3’ [-Wfree-nonheap-object] 50 | #define mem_Free free smartcard/scard/scard_wrap.c:4750:14: note: declared here 4750 | STRINGLIST temp3 ; | ^~~~~ /usr/bin/gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -g -fwrapv -O3 -Wall -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -DVER_PRODUCTVERSION=2,0,8,0000 -DVER_PRODUCTVERSION_STR=2.0.8 -DPCSCLITE=1 -Ismartcard/scard/ -I/usr/include/python3.9 -c smartcard/scard/winscarddll.c -o build/temp.linux-x86_64-cpython-39/smartcard/scard/winscarddll.o -I/usr/include/PCSC -pthread creating build/lib.linux-x86_64-cpython-39 creating build/lib.linux-x86_64-cpython-39/smartcard creating build/lib.linux-x86_64-cpython-39/smartcard/scard /usr/bin/gcc -shared -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security build/temp.linux-x86_64-cpython-39/smartcard/scard/helpers.o build/temp.linux-x86_64-cpython-39/smartcard/scard/scard_wrap.o build/temp.linux-x86_64-cpython-39/smartcard/scard/winscarddll.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-39/smartcard/scard/_scard.cpython-39-x86_64-linux-gnu.so smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardGetAttrib’: smartcard/scard/scard_wrap.c:4244:9: warning: ‘free’ called on unallocated object ‘temp3’ [-Wfree-nonheap-object] 4244 | mem_Free( arg3 ); | ^ smartcard/scard/scard_wrap.c:4203:12: note: declared here 4203 | BYTELIST temp3 ; | ^ smartcard/scard/scard_wrap.c:4259:9: warning: ‘free’ called on unallocated object ‘temp3’ [-Wfree-nonheap-object] 4259 | mem_Free( arg3 ); | ^ smartcard/scard/scard_wrap.c:4203:12: note: declared here 4203 | BYTELIST temp3 ; | ^ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardControl’: smartcard/scard/scard_wrap.c:4397:9: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 4397 | mem_Free( arg4 ); | ^ smartcard/scard/scard_wrap.c:4338:12: note: declared here 4338 | BYTELIST temp4 ; | ^ smartcard/scard/scard_wrap.c:4425:9: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 4425 | mem_Free( arg4 ); | ^ smartcard/scard/scard_wrap.c:4338:12: note: declared here 4338 | BYTELIST temp4 ; | ^ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardTransmit’: smartcard/scard/scard_wrap.c:5265:9: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 5265 | mem_Free( arg4 ); | ^ smartcard/scard/scard_wrap.c:5206:12: note: declared here 5206 | BYTELIST temp4 ; | ^ smartcard/scard/scard_wrap.c:5293:9: warning: ‘free’ called on unallocated object ‘temp4’ [-Wfree-nonheap-object] 5293 | mem_Free( arg4 ); | ^ smartcard/scard/scard_wrap.c:5206:12: note: declared here 5206 | BYTELIST temp4 ; | ^ smartcard/scard/scard_wrap.c: In function ‘_wrap_SCardStatus’: smartcard/scard/scard_wrap.c:5154:9: warning: ‘free’ called on unallocated object ‘temp5’ [-Wfree-nonheap-object] 5154 | mem_Free( arg5 ); | ^ smartcard/scard/scard_wrap.c:5077:12: note: declared here 5077 | BYTELIST temp5 ; | ^ smartcard/scard/scard_wrap.c:5190:9: warning: ‘free’ called on unallocated object ‘temp5’ [-Wfree-nonheap-object] 5190 | mem_Free( arg5 ); | ^ smartcard/scard/scard_wrap.c:5077:12: note: declared here 5077 | BYTELIST temp5 ; | ^ ```
LudovicRousseau commented 3 months ago

I know. Is this a real issue for you?

kloczek commented 3 months ago

Let's say that it is low priority issue 😋

LudovicRousseau commented 3 months ago

Fixed. Thanks.