-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fixed assorted compiler warnings #22
Conversation
Just a general comment on one particular category you’ve looked at in this PR. Adding the tested condition for the |
Thanks, that is good to know it would be useful for you. It is a feature of the standard library |
7ee4f66
to
4efc904
Compare
Random comments:
Regarding the first comment above, I'm unsure how to proceed: amend or add a patch. My preference is to have bisectable code, which would mean amending the offending git change, instead of adding a new commit after. For the second comment, this can come as a later patch. |
Please feel free to amend my commit. I changed the base of your PR, so it should automatically update when this is fixed (might need a quick rebase).
I previously moved the assert changes to #24, which does add the noreturn attribute, but this is currently blocked on fixing #10. Feel free to make additional changes in the PR if you want. |
Introduced some local non const addr_/addi_ variables to prevent some compilation errors in single thread build. This affects radix{128,256,384,1024}_main_carry_loop.h.
I force pushed the change. I will use this as a basis to fix other errors for single-thread compilation (if that proves possible at all, which I'm not sure is the case). |
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.
-- ignore --
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.
This looks good to me.
The only thing I'd add is the removal of the snprintf_warn macro. This can be taken care of later and should not block the merging.
stringop-truncation
warnings.snprintf_nowarn
macro, which revealed some hidden warnings.format-truncation
warnings by doubling the size of thecbuf
array.discarded-qualifiers
warnings.ASSERT
function to (partially) use a macro instead,similar to the C standard library assert macro in.assert.h
This should reduce the number of false positive warnings, as compilers and static analyzers can much more easily check if the assert is going to fail.ASSERT
function, which shows the function name in error messagesand I renamed it to. I also added the assertion string to the error messages.ABORT
HERE
argument, which I added to the macro instead. This was a major change, as Ernst had over 4,000 assert statements.This should result in a performance improvement, as it no longer needs to call a function to test the expression.int8_t
,int16_t
,int32_t
andint64_t
integer types fromstdint.h
instead of redefining them.printf
calls to use the defines frominttypes.h
.stdbool.h
while I was at it.This pull request is a work in progress, as I am not sure it is the best way to fix some of these warnings. I would recommend reviewing each commit individually. Feedback is welcome!