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

fix: fix warning about yyget_leng returning wrong type when using LTO #676

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

szhorvat
Copy link
Member

@szhorvat szhorvat commented Feb 13, 2023

This attempt to fix the following errors found by CRAN:

https://www.stats.ox.ac.uk/pub/bdr/LTO/igraph.out

src/core/io/pajek-lexer.h:500:8: warning: type of ‘igraph_pajek_yyget_leng’ does not match original declaration [-Wlto-type-mismatch]
src/core/io/pajek-lexer.c:2457:11: note: return value type mismatch
src/core/io/pajek-lexer.c:2457:11: note: type ‘yy_size_t’ should match type ‘int’
src/core/io/pajek-lexer.c:2457:11: note: ‘igraph_pajek_yyget_leng’ was previously declared here
src/core/io/pajek-lexer.c:2457:11: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used

I noticed that this problem does not occur when compiling the C core separately. In fact, it seems that yyget_leng should return int instead fo yy_size_t.

This PR removes the string replacement that was meant to maintain compatibility with the ancient flex version that comes with macOS. Since we now generate parser sources with the latest flex on CI, I think there is no need for this fix anymore.

An alternative would be to avoid doing the replacement for yyget_leng.


Note: I used the latest flex 2.6.4. for this. Not sure why it generated slightly different line numbers.

@szhorvat szhorvat requested review from krlmlr and ntamas and removed request for krlmlr February 13, 2023 12:29
@ntamas ntamas merged commit d0092a2 into main Feb 13, 2023
@ntamas ntamas deleted the fix/flex-yy_size_t branch February 13, 2023 13:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants