Skip to content

Conversation

bxparks
Copy link
Contributor

@bxparks bxparks commented Apr 2, 2021

The compiler prints the following warning messages on SafeRingBuffer.h:

$ au --cli verify mkr1000 ArithmeticTest/
...
+ /home/brian/bin/linux/arduino-cli  compile  --fqbn arduino:samd:mkr1000  --warnings all --build-property 'compiler.cpp.extra_flags=-D AUNITER -D AUNITER_MKR1000 ' ArithmeticTest/ArithmeticTest.ino
In file included from /home/brian/dev/arduino-1.8.13/portable/packages/arduino/hardware/samd/1.8.11/cores/arduino/Uart.h:23:0,
                 from /home/brian/dev/arduino-1.8.13/portable/packages/arduino/hardware/samd/1.8.11/variants/mkr1000/variant.h:164,
                 from /home/brian/dev/arduino-1.8.13/portable/packages/arduino/hardware/samd/1.8.11/cores/arduino/Arduino.h:51,
                 from /home/brian/dev/arduino-1.8.13/portable/packages/arduino/hardware/samd/1.8.11/cores/arduino/Uart.cpp:19:
/home/brian/dev/arduino-1.8.13/portable/packages/arduino/hardware/samd/1.8.11/cores/arduino/SafeRingBuffer.h: In member function 'int arduino::SafeRingBufferN<N>::read_char() [with int N = 64]':
/home/brian/dev/arduino-1.8.13/portable/packages/arduino/hardware/samd/1.8.11/cores/arduino/SafeRingBuffer.h:44:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

The compiler cannot figure out that the end of the function will never be reached. This prevents the warning by adding a return -1 at the end of the function.

@facchinm facchinm mentioned this pull request Apr 6, 2021
@facchinm facchinm merged commit cfa2899 into arduino:master Apr 6, 2021
@bxparks bxparks deleted the saferingbuffer branch June 1, 2023 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants