amazon/ion/ioncmodule.c:183:10: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
amazon/ion/ioncmodule.c:184:5: warning: unused label 'fail' [-Wunused-label]
amazon/ion/ioncmodule.c:546:54: warning: cast to 'ION_TYPE' (aka 'struct ion_type *') from smaller integer type 'int' [-Wint-to-pointer-cast]
amazon/ion/ioncmodule.c:715:53: warning: cast to 'ION_TYPE' (aka 'struct ion_type *') from smaller integer type 'int' [-Wint-to-pointer-cast]
amazon/ion/ioncmodule.c:740:57: warning: cast to 'ION_TYPE' (aka 'struct ion_type *') from smaller integer type 'int' [-Wint-to-pointer-cast]
amazon/ion/ioncmodule.c:767:5: warning: unused label 'fail' [-Wunused-label]
amazon/ion/ioncmodule.c:798:21: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
amazon/ion/ioncmodule.c:812:14: warning: unused variable 'last_element' [-Wunused-variable]
amazon/ion/ioncmodule.c:786:5: warning: variable 'writer' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
amazon/ion/ioncmodule.c:779:9: warning: variable 'writer' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
amazon/ion/ioncmodule.c:1109:28: warning: comparison between pointer and integer ('ION_TYPE' (aka 'struct ion_type *') and 'int') [-Wpointer-integer-compare]
amazon/ion/ioncmodule.c:1516:12: warning: incompatible pointer types returning 'ionc_read_Iterator *' from a function with result type 'PyObject *' (aka 'struct _object *') [-Wincompatible-pointer-types]
Most of these aren't too concerning, just noisy. However, the warnings about potential use of the uninitialized writer could result in a segfault under error conditions. If the uninitialized writer was non-zero, ion_writer_close would be called, which could result in dereference of the invalid pointer.
It would probably be worthwhile to upgrade warnings into errors for the c extension itself.
Issue #, if available: n/a
Description of changes: Prior to this PR compilation of the C extension resulted in quite a bit of noise from compiler warnings and associated notes:
The warnings consisted of the following:
Most of these aren't too concerning, just noisy. However, the warnings about potential use of the uninitialized
writer
could result in a segfault under error conditions. If the uninitialized writer was non-zero,ion_writer_close
would be called, which could result in dereference of the invalid pointer.It would probably be worthwhile to upgrade warnings into errors for the c extension itself.
After this PR:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.