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

std=c99 required by gcc 4.8.5 #1523

Closed
lmjakt opened this issue Nov 16, 2022 · 2 comments · Fixed by #1524
Closed

std=c99 required by gcc 4.8.5 #1523

lmjakt opened this issue Nov 16, 2022 · 2 comments · Fixed by #1524

Comments

@lmjakt
Copy link

lmjakt commented Nov 16, 2022

I suspect that you may already be aware of the following, but if not perhaps it is useful to know:

I get the following errors and suggestions from gcc (4.8.5) when compiling hstlib, samtools or bcftools:

vcf.c:5109:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int idx = 0; idx < sizeof(errdesc_bcf) / sizeof(err_desc); ++idx) {
     ^
vcf.c:5109:5: note: use option -std=c99 or -std=gnu99 to compile your code

they are solved by adding -std=gnu99 to the CFLAGS of the Makefiles of hstlib, samtools and bcftools.

I presume that this is specific to the version of gcc and hence not that important. Especially as it seems like there is a plan to specify std=c99 from looking at the htslib Makefile.

So this does not seem to be a problem per se, but I'm wondering whether there there is any potential problem with adding std=c99 or std=gnu99?

cheers,

Martin

@daviesrob
Copy link
Member

It shouldn't cause a problem, as we do test builds with -std=c99. But thanks for reporting this, as we try to avoid putting declarations in for loops to keep early versions of gcc happy. Unfortunately it looks like one sneaked through here; we'll remove it.

@lmjakt
Copy link
Author

lmjakt commented Nov 17, 2022

Thanks for your reply and your efforts to keep htslib compatible across many compilers. I very much appreciate that style of coding.

cheers,

Martin

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 a pull request may close this issue.

2 participants