-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Enable extra warnings for mpy-cross and unix port #6510
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
Changes from all commits
6324c3e
6d3aa16
fdd6fa3
9aa58cf
f1f6ef7
dde3db2
ccd9233
bef4127
05f9568
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 |
---|---|---|
|
@@ -108,7 +108,7 @@ STATIC mp_uint_t emit_inline_thumb_count_params(emit_inline_asm_t *emit, mp_uint | |
return 0; | ||
} | ||
const char *p = qstr_str(MP_PARSE_NODE_LEAF_ARG(pn_params[i])); | ||
if (!(strlen(p) == 2 && p[0] == 'r' && p[1] == '0' + i)) { | ||
if (!(strlen(p) == 2 && p[0] == 'r' && (mp_uint_t)p[1] == '0' + i)) { | ||
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. Just a question: C99 guarantees that 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. Yes, as far as I understand when you have signed + unsigned then the signed value is promoted to unsigned, and then they're widened to the widest integer, which in this case is mp_uint_t (which should be wider than char). 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. Ugh, it's more complicated than that. First both sides are promoted to So here '0' is automatically converted to 'int', and then (assuming |
||
emit_inline_thumb_error_msg(emit, MP_ERROR_TEXT("parameters must be registers in sequence r0 to r3")); | ||
return 0; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -298,7 +298,8 @@ STATIC void gc_sweep(void) { | |
#if MICROPY_PY_GC_COLLECT_RETVAL | ||
MP_STATE_MEM(gc_collected)++; | ||
#endif | ||
// fall through to free the head | ||
// fall through to free the head | ||
MP_FALLTHROUGH | ||
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. A nice bonus: uncrustify now indents the comment to the correct level because it sees |
||
|
||
case AT_TAIL: | ||
if (free_tail) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1643,6 +1643,13 @@ typedef double mp_float_t; | |
#endif | ||
#endif | ||
|
||
// Explicitly annotate switch case fall throughs | ||
#if defined(__GNUC__) && __GNUC__ >= 7 | ||
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. How about enabling 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. Yeah, I tried that in the first three attempts, but it turns out clang only does -Wimplicit-fallthrough for C++ 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. Aha ok, wasn't clear to me. 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. No, me neither |
||
#define MP_FALLTHROUGH __attribute__((fallthrough)); | ||
#else | ||
#define MP_FALLTHROUGH | ||
#endif | ||
|
||
#ifndef MP_HTOBE16 | ||
#if MP_ENDIANNESS_LITTLE | ||
#define MP_HTOBE16(x) ((uint16_t)((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))) | ||
|
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.
Since these are required args they don't need a default value. But I can see why the compiler complains, and it won't hurt to have defaults here (shouldn't add anything to code size). So this is OK!
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.
Agreed. I think this pretty much reflects what is in the commit message. 👍
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.
Yes indeed! I didn't read the commit message...