Fix const-related warnings, and a few others#797
Conversation
brturn
left a comment
There was a problem hiding this comment.
Recommend some changes.
Also, I'm not getting the buffer warnings you describe when compiling with clang. Which compiler are you using, and what is the buffer warning flag that it is using?
This fixes all warnings related to pointers to consts. It also fixes a few other straightforward-to-fix warnings. There's a few cases where there's a type like `creature *hitList[8]`, which seem like they should be able to be `const`, but doing so requires some ugly casts, so this makes them non-const, for simplicity. In all other cases, this commit adds `const`s rather than removing them.
11a5a58 to
80dbd10
Compare
I'm using |
tmewett
left a comment
There was a problem hiding this comment.
Thanks. I agree with the rationale for the removal of those consts; I'm not sure consts add huge value to the Brogue architecture
This fixes all warnings related to pointers to consts. It also fixes a few other straightforward-to-fix warnings which didn't seem big enough for a separate commit (though I'm happy to make separate commits for them if that would be helpful).
There's a few cases where there's a type like
creature *hitList[8], which seem like they should be able to beconst, but doing so requires some ugly casts, so this makes them non-const, for simplicity. In all other cases, this commit addsconsts rather than removing them.After this commit, the vast majority of warnings displayed on my system are along the lines of "output may be truncated copying 299 bytes from a string of length 299 " or "reading 100 bytes from a region of size 10". I intend to look into those later.