Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyBigWig.c: fix build failure with gcc 14. #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emollier
Copy link

As initially identified in Debian bug #1075407, pyBigWig fails to build with gcc 14 with the following relevant output:

pyBigWig.c:773:12: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  773 |     return PyUnicode_AsUTF8(obj);
      |            ^~~~~~~~~~~~~~~~~~~~~
pyBigWig.c: In function ‘pyBwAddHeader’:
pyBigWig.c:897:32: error: passing argument 1 of ‘bwCreateChromList’ from incompatible pointer type [-Wincompatible-pointer-types]
  897 |     bw->cl = bwCreateChromList(chroms, lengths, n);
      |                                ^~~~~~
      |                                |
      |                                char **
In file included from pyBigWig.h:3,
                 from pyBigWig.c:3:
/usr/include/bigWig.h:497:51: note: expected ‘const char * const*’ but argument is of type ‘char **’
  497 | chromList_t *bwCreateChromList(const char* const* chroms, const uint32_t *lengths, int64_t n);
      |                                ~~~~~~~~~~~~~~~~~~~^~~~~~
pyBigWig.c: In function ‘PyAddIntervals’:
pyBigWig.c:1251:29: error: passing argument 2 of ‘bwAddIntervals’ from incompatible pointer type [-Wincompatible-pointer-types]
 1251 |     rv = bwAddIntervals(bw, cchroms, ustarts, uends, fvalues, n);
      |                             ^~~~~~~
      |                             |
      |                             char **
/usr/include/bigWig.h:524:57: note: expected ‘const char * const*’ but argument is of type ‘char **’

This is because starting with gcc 14, incompatible pointer types are now fatal by default. This patch fixes/workarounds the issue by casting affected pointers upon argument passing to function calls.

As initially identified in [Debian bug #1075407], pyBigWig fails to
build with gcc 14 with the following relevant output:

	pyBigWig.c:773:12: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
	  773 |     return PyUnicode_AsUTF8(obj);
	      |            ^~~~~~~~~~~~~~~~~~~~~
	pyBigWig.c: In function ‘pyBwAddHeader’:
	pyBigWig.c:897:32: error: passing argument 1 of ‘bwCreateChromList’ from incompatible pointer type [-Wincompatible-pointer-types]
	  897 |     bw->cl = bwCreateChromList(chroms, lengths, n);
	      |                                ^~~~~~
	      |                                |
	      |                                char **
	In file included from pyBigWig.h:3,
	                 from pyBigWig.c:3:
	/usr/include/bigWig.h:497:51: note: expected ‘const char * const*’ but argument is of type ‘char **’
	  497 | chromList_t *bwCreateChromList(const char* const* chroms, const uint32_t *lengths, int64_t n);
	      |                                ~~~~~~~~~~~~~~~~~~~^~~~~~
	pyBigWig.c: In function ‘PyAddIntervals’:
	pyBigWig.c:1251:29: error: passing argument 2 of ‘bwAddIntervals’ from incompatible pointer type [-Wincompatible-pointer-types]
	 1251 |     rv = bwAddIntervals(bw, cchroms, ustarts, uends, fvalues, n);
	      |                             ^~~~~~~
	      |                             |
	      |                             char **
	/usr/include/bigWig.h:524:57: note: expected ‘const char * const*’ but argument is of type ‘char **’

This is because starting with gcc 14, incompatible pointer types are
now fatal by default.  This patch fixes/workarounds the issue by
casting affected pointers upon argument passing to function calls.

[Debian bug #1075407]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075407

Signed-off-by: Étienne Mollier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant