Conversation
The compiler now infers constness through string functions. Adhere to that. It also now warns about using multiplications in conditions.
iluuu1994
left a comment
There was a problem hiding this comment.
We usually get reports for stable branches when new compiler versions become generally available, should be backport immediately or wait until that happens?
|
|
||
| while (ptr && *ptr) { | ||
| end = strchr(ptr, DEFAULT_DIR_SEPARATOR); | ||
| end = (char *) strchr(ptr, DEFAULT_DIR_SEPARATOR); |
There was a problem hiding this comment.
I don't understand this cast, why is it necessary?
There was a problem hiding this comment.
ptr is a const char * but end is a char *.
end cannot be made const because it is written to on line 1780. At that point, ptr actually isn't pointing to a constant character buffer anymore.
I didn't want to do too many changes because to fix this nicely we'd need to split the ptr variable.
There was a problem hiding this comment.
Oh ok, so the return type of strchr is now effectively const-generic. Right, it does seem like it would be best to split the vars. I'd prefer that, at least for master.
This is the compiler that has been shipping for a few weeks now on Arch/Manjaro. So I'd say we go ahead with doing it directly in 8.4. |
The compiler now infers constness through string functions. Adhere to that.
It also now warns about using multiplications in conditions.