bbcmicrobit / bbcmicrobit/micropython

Compiler warnings

Open
#627 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
646
Forks
290
PR merge metrics
No merged PRs in 30d

Description

When building with Ubuntu 19.04's arm-none-eabi-gcc (`(15:7-2018-q2-4) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]`):

```
[116/324] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/core/MicroBitFiber.cpp.o
yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp: In function 'void scheduler_init(EventModel&)':
yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:189:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (fiber_scheduler_running())
^~
yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:194:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
messageBus = &_messageBus;
^~~~~~~~~~
yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp: In function 'int fiber_wait_for_event(uint16_t, uint16_t)':
yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:388:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if(ret == MICROBIT_OK)
^~
yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:391:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
return ret;
^~~~~~
[122/324] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/core/MicroBitHeapAllocator.cpp.o
yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp: In function 'void free(void*)':
yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp:342:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (*cb == 0 || *cb & MICROBIT_HEAP_BLOCK_FREE)
^~
yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp:345:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
*cb |= MICROBIT_HEAP_BLOCK_FREE;
^
[174/324] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/bluetooth/MicroBitIOPinService.cpp.o
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp: In member function 'void MicroBitIOPinService::onDataWritten(const GattWriteCallbackParams*)':
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:179:42: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getDigitalValue();
~~~~~~~~~~~~~~~~~~~~~~~~~^~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:182:41: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getAnalogValue();
~~~~~~~~~~~~~~~~~~~~~~~~^~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:199:41: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getDigitalValue();
~~~~~~~~~~~~~~~~~~~~~~~~~^~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:202:40: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getAnalogValue();
~~~~~~~~~~~~~~~~~~~~~~~~^~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:224:43: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[pin].setAnalogValue(value);
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:225:46: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[pin].setAnalogPeriodUs(period);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:245:51: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[data->pin].setDigitalValue(data->value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:247:50: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[data->pin].setAnalogValue(data->value == 255 ? 1023 : data->value << 2);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp: In member function 'void MicroBitIOPinService::updateBLEInputs(bool)':
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:136:50: warning: array subscript is above array bounds [-Warray-bounds]
value = io.pin[i].getDigitalValue();
~~~~~~~~~~~~~~~~~~~~~~~~~^~
yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:138:49: warning: array subscript is above array bounds [-Warray-bounds]
value = io.pin[i].getAnalogValue() >> 2;
~~~~~~~~~~~~~~~~~~~~~~~~^~
[192/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/py/compile2.c.o
source/py/compile2.c: In function 'compile_const_object':
source/py/compile2.c:2550:79: warning: unused parameter 'ptop' [-Wunused-parameter]
STATIC void compile_const_object(compiler_t *comp, const byte *p, const byte *ptop) {
^~~~
[214/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/lib/sam/sam.c.o
source/lib/sam/sam.c: In function 'SAMMain':
source/lib/sam/sam.c:125:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (debug)
^~
source/lib/sam/sam.c:127:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
InsertBreath(sam);
^~~~~~~~~~~~
source/lib/sam/sam.c:134:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (strcmp(sam_error, "OK"))
^~
source/lib/sam/sam.c:136:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
return 1;
^~~~~~
[249/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/py/nlrthumb.c.o
source/py/nlrthumb.c: In function 'nlr_push':
source/py/nlrthumb.c:40:57: warning: unused parameter 'nlr' [-Wunused-parameter]
__attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {
^~~
[254/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/lib/sam/render.c.o
source/lib/sam/render.c: In function 'Read':
source/lib/sam/render.c:51:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (p > RENDER_FRAMES) {
^
source/lib/sam/render.c: In function 'Write':
source/lib/sam/render.c:71:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (p > RENDER_FRAMES) {
^
source/lib/sam/render.c: In function 'RenderSample':
source/lib/sam/render.c:170:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (X >= sizeof(tab48426))
^~
source/lib/sam/render.c:172:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
mem53 = tab48426[X];
^~~~~
[264/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/py/emitinlinethumb.c.o
source/py/emitinlinethumb.c: In function 'emit_inline_thumb_end_pass':
source/py/emitinlinethumb.c:97:75: warning: unused parameter 'type_sig' [-Wunused-parameter]
STATIC void emit_inline_thumb_end_pass(emit_inline_asm_t *emit, mp_uint_t type_sig) {
^~~~~~~~
[265/324] Building CXX object source/CMakeFiles/microbit-micropython.dirsource/microbit/modaudio.cpp.o
source/microbit/modaudio.cpp: In function 'void* audio_frame_binary_op(mp_uint_t, mp_obj_t, mp_obj_t)':
source/microbit/modaudio.cpp:601:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
lhs = copy(lhs);
~~~~^~~~~~~~~~~
source/microbit/modaudio.cpp:602:5: note: here
case MP_BINARY_OP_INPLACE_ADD:
^~~~
source/microbit/modaudio.cpp:610:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
lhs = copy(lhs);
~~~~^~~~~~~~~~~
source/microbit/modaudio.cpp:611:5: note: here
case MP_BINARY_OP_INPLACE_MULTIPLY:
^~~~
[271/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/py/gc.c.o
source/py/gc.c: In function 'gc_sweep':
source/py/gc.c:281:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
free_tail = 1;
~~~~~~~~~~^~~
source/py/gc.c:288:13: note: here
case AT_TAIL:
^~~~
[277/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/py/objset.c.o
source/py/objset.c: In function 'set_unary_op':
source/py/objset.c:465:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (MP_OBJ_IS_TYPE(self_in, &mp_type_frozenset)) {
^
source/py/objset.c:479:9: note: here
default: return MP_OBJ_NULL; // op not supported
^~~~~~~
[321/324] Building C object source/CMakeFiles/microbit-micropython.dirsource/py/lexer.c.o
source/py/lexer.c: In function 'parse_string_literal':
source/py/lexer.c:322:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (lex->tok_kind == MP_TOKEN_BYTES) {
^
source/py/lexer.c:328:25: note: here
case 'x':
^~~~
```
Some of these warnings are from upstream microbit and yotta and the DAL.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.