-
Notifications
You must be signed in to change notification settings - Fork 442
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 clang-13 unused variable messages. #1334
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3584,7 +3584,7 @@ bcf_hdr_t *bcf_hdr_merge(bcf_hdr_t *dst, const bcf_hdr_t *src) | |
return dst; | ||
} | ||
|
||
int i, ndst_ori = dst->nhrec, need_sync = 0, ret = 0, res; | ||
int i, ndst_ori = dst->nhrec, need_sync = 0, res; | ||
for (i=0; i<src->nhrec; i++) | ||
{ | ||
if ( src->hrec[i]->type==BCF_HL_GEN && src->hrec[i]->value ) | ||
|
@@ -3641,13 +3641,11 @@ bcf_hdr_t *bcf_hdr_merge(bcf_hdr_t *dst, const bcf_hdr_t *src) | |
{ | ||
hts_log_warning("Trying to combine \"%s\" tag definitions of different lengths", | ||
src->hrec[i]->vals[0]); | ||
ret |= 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get the feeling that there was an intention to do something else if this problem (or the one below) was detected. While it has been ignored for now, I think it would be good to check while our attention has been drawn to this bit of code. Maybe @pd3 could let us know how catastrophic the problems being warned about might be? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are all like that. Things that did something, or were meant to do something, and have been left behind. If the people who wrote it want an alternative fix then they are free to overwrite my changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case I don't think it ever did anything. But it would be good to at least raise an issue if we think it really should be doing something, so we remember to fix it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be a problem but does not have to be. Probably best if the function was able to set an error code which could be optionally checked by the caller? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately the only way the function can report errors at the moment is to return NULL. While it already does for other detected problems, it never has for these. As in the case of these particular warnings you'll always have supplied a Presumably if you get these warnings, one of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for not being clear, I meant if maybe The consequence depends on the user application. The current uses in BCFtools are okay with it, another check can be performed at the data record level. Probably best and easiest would be to provide a new function, in case it is ever needed. For now I am completely okay with leaving it as is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'd have to return If you can check this on data records then I guess it's OK to ignore for now. |
||
} | ||
if ( (kh_val(d_src,k_src).info[rec->type]>>4 & 0xf) != (kh_val(d_dst,k_dst).info[rec->type]>>4 & 0xf) ) | ||
{ | ||
hts_log_warning("Trying to combine \"%s\" tag definitions of different types", | ||
src->hrec[i]->vals[0]); | ||
ret |= 1; | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it would be good if @jkbonfield can confirm that this wasn't being ignored by mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code had this after the main loop:
assert(ntot == st->nsamp);
It looks like it was basically debugging code during development that was culled incompletely. We could of course add a check back and handle the error in a more graceful way, but it's been working this long just fine so it seems rather pointless.
Furthermore, the entire huffman encode-side is now basically defunct, along with most of the other CORE bit-shoveling techniques. We write to "external" blocks and use rANS instead as this is fast and decouples the streams from one another permitting selective decoding. Maybe one day if we ever release CRAM 4 we can reenable the bit encoders, directing their output somewhere other than CORE block, but it would break CRAM 3 for now.
The decoder is still needed as we may find crams that use them, but for encoding the only bit of huffman we (ab)use is as a constant value encoder by generating a huffman tree with 1 symbol having a code length of 0 bits. (Plus we don't actually use the general purpose huffman decoder then as it has a custom constant-value handler.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Good to be sure it wasn't supposed to be there.