Silence GCC -Wall

This commit is contained in:
Robert May 2015-10-27 22:17:04 +00:00
parent 3a8c72144f
commit 1a1a5976a8
12 changed files with 32 additions and 14 deletions

View file

@ -32,7 +32,11 @@
#include "MicroBitFiber.h"
#include "MicroBitMessageBus.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "ble/BLE.h"
#pragma GCC diagnostic pop
#include "ble/services/DeviceInformationService.h"
#include "MicroBitDFUService.h"
#include "MicroBitEventService.h"
@ -270,7 +274,7 @@ class MicroBit
* @return A textual description of the currentlt executing micro:bit runtime.
* TODO: handle overflow case.
*/
char *systemVersion();
const char *systemVersion();
/**
* Triggers a microbit panic where an infinite loop will occur swapping between the panicFace and statusCode if provided.

View file

@ -127,7 +127,7 @@ ManagedString::ManagedString(const ManagedString &s1, const ManagedString &s2)
ManagedString::ManagedString(const char *str, const int16_t length)
{
// Sanity check. Return EmptyString for anything distasteful
if (str == NULL || *str == 0 || length > strlen(str))
if (str == NULL || *str == 0 || (uint16_t)length > strlen(str)) // XXX length should be unsigned on the interface
{
initEmpty();
return;

View file

@ -33,6 +33,9 @@ microbit_reset()
*/
void bleDisconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
{
(void) handle; /* -Wunused-param */
(void) reason; /* -Wunused-param */
uBit.ble->startAdvertising();
}
@ -478,7 +481,7 @@ unsigned long MicroBit::systemTime()
* @return A textual description of the currentlt executing micro:bit runtime.
* TODO: handle overflow case.
*/
char *MicroBit::systemVersion()
const char *MicroBit::systemVersion()
{
return MICROBIT_DAL_VERSION;
}

View file

@ -87,7 +87,7 @@ void MicroBitDisplay::renderFinish()
//kept inline to reduce overhead
//clear the old bit pattern for this row.
//clear port 0 4-7 and retain lower 4 bits
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT0, 0xF0 | nrf_gpio_port_read(NRF_GPIO_PORT_SELECT_PORT0) & 0x0F);
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT0, 0xF0 | (nrf_gpio_port_read(NRF_GPIO_PORT_SELECT_PORT0) & 0x0F));
// clear port 1 8-12 for the current row
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT1, strobeBitMsk | 0x1F);
@ -132,7 +132,7 @@ void MicroBitDisplay::render()
//write the new bit pattern
//set port 0 4-7 and retain lower 4 bits
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT0, ~coldata<<4 & 0xF0 | nrf_gpio_port_read(NRF_GPIO_PORT_SELECT_PORT0) & 0x0F);
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT0, (~coldata<<4 & 0xF0) | (nrf_gpio_port_read(NRF_GPIO_PORT_SELECT_PORT0) & 0x0F));
//set port 1 8-12 for the current row
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT1, strobeBitMsk | (~coldata>>4 & 0x1F));
@ -180,7 +180,7 @@ void MicroBitDisplay::renderGreyscale()
}
//write the new bit pattern
//set port 0 4-7 and retain lower 4 bits
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT0, ~coldata<<4 & 0xF0 | nrf_gpio_port_read(NRF_GPIO_PORT_SELECT_PORT0) & 0x0F);
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT0, (~coldata<<4 & 0xF0) | (nrf_gpio_port_read(NRF_GPIO_PORT_SELECT_PORT0) & 0x0F));
//set port 1 8-12 for the current row
nrf_gpio_port_write(NRF_GPIO_PORT_SELECT_PORT1, strobeBitMsk | (~coldata>>4 & 0x1F));

View file

@ -130,8 +130,8 @@ Fiber *getFiberContext()
if (f == NULL)
return NULL;
f->stack_bottom = NULL;
f->stack_top = NULL;
f->stack_bottom = 0;
f->stack_top = 0;
}
// Ensure this fiber is in suitable state for reuse.
@ -512,7 +512,7 @@ Fiber *__create_fiber(uint32_t ep, uint32_t cp, uint32_t pm, int parameterised)
*/
Fiber *create_fiber(void (*entry_fn)(void), void (*completion_fn)(void))
{
return __create_fiber((uint32_t) entry_fn, (uint32_t)completion_fn, NULL, 0);
return __create_fiber((uint32_t) entry_fn, (uint32_t)completion_fn, 0, 0);
}
@ -535,6 +535,8 @@ Fiber *create_fiber(void (*entry_fn)(void *), void *param, void (*completion_fn)
*/
void release_fiber(void * param)
{
(void)param; /* -Wunused-parameter */
release_fiber();
}
@ -688,7 +690,7 @@ void schedule()
if (oldFiber == idleFiber)
{
// Just swap in the new fiber, and discard changes to stack and register context.
swap_context(NULL, &currentFiber->tcb, NULL, currentFiber->stack_top);
swap_context(NULL, &currentFiber->tcb, 0, currentFiber->stack_top);
}
else
{

View file

@ -32,7 +32,7 @@ struct HeapDefinition
// Create the necessary heap definitions.
// We use two heaps by default: one for SoftDevice reuse, and one to run inside the mbed heap.
HeapDefinition heap[MICROBIT_HEAP_COUNT] = { NULL };
HeapDefinition heap[MICROBIT_HEAP_COUNT] = { };
// Scans the status of the heap definition table, and returns the number of INITIALISED heaps.
int microbit_active_heaps()

View file

@ -67,6 +67,7 @@ void MicroBitAccelerometerService::onDataWritten(const GattWriteCallbackParams *
*/
void MicroBitAccelerometerService::accelerometerUpdate(MicroBitEvent e)
{
(void) e; /* -Wunused-parameter */
if (ble.getGapState().connected)
{
accelerometerDataCharacteristicBuffer[0] = uBit.accelerometer.getX();

View file

@ -51,6 +51,7 @@ MicroBitDFUService::MicroBitDFUService(BLEDevice &_ble) :
void MicroBitDFUService::onButtonA(MicroBitEvent e)
{
(void) e; /* -Wunused-parameter */
if (flashCodeRequested)
{
releaseFlashCode();
@ -63,6 +64,7 @@ void MicroBitDFUService::onButtonA(MicroBitEvent e)
void MicroBitDFUService::onButtonB(MicroBitEvent e)
{
(void) e; /* -Wunused-parameter */
uBit.display.scroll("VERSION: TODO");
showNameHistogram();
}

View file

@ -138,7 +138,7 @@ void MicroBitIOPinService::onDataWritten(const GattWriteCallbackParams *params)
if (params->handle == ioPinServiceDataCharacteristic->getValueHandle())
{
// We have some pin data to change...
int len = params->len;
uint16_t len = params->len;
IOData *data = (IOData *)params->data;
// There may be multiple write operaitons... take each in turn and update the pin values

View file

@ -59,7 +59,7 @@ void MicroBitLEDService::onDataWritten(const GattWriteCallbackParams *params)
{
for (int y=0; y<params->len; y++)
for (int x=0; x<5; x++)
uBit.display.image.setPixelValue(x, y, (data[y] & (0x01 << 4-x)) ? 255 : 0);
uBit.display.image.setPixelValue(x, y, (data[y] & (0x01 << (4-x))) ? 255 : 0);
}
else if (params->handle == textCharacteristicHandle)
@ -94,7 +94,7 @@ void MicroBitLEDService::onDataRead(GattReadAuthCallbackParams *params)
for (int x=0; x<5; x++)
{
if (uBit.display.image.getPixelValue(x, y))
matrixCharacteristicBuffer[y] |= 0x01 << 4-x;
matrixCharacteristicBuffer[y] |= 0x01 << (4-x);
}
}

View file

@ -69,6 +69,8 @@ void MicroBitMagnetometerService::onDataWritten(const GattWriteCallbackParams *p
*/
void MicroBitMagnetometerService::magnetometerUpdate(MicroBitEvent e)
{
(void) e; /* -Wunused-parameter */
if (ble.getGapState().connected)
{
magnetometerDataCharacteristicBuffer[0] = uBit.compass.getX();
@ -90,6 +92,8 @@ void MicroBitMagnetometerService::magnetometerUpdate(MicroBitEvent e)
*/
void MicroBitMagnetometerService::samplePeriodUpdateNeeded(MicroBitEvent e)
{
(void) e; /* -Wunused-parameter */
// Reconfigure the compass. This might take a while...
uBit.compass.setPeriod(magnetometerPeriodCharacteristicBuffer);

View file

@ -47,6 +47,8 @@ MicroBitTemperatureService::MicroBitTemperatureService(BLEDevice &_ble) :
*/
void MicroBitTemperatureService::temperatureUpdate(MicroBitEvent e)
{
(void) e; /* -Wunused-parameter */
if (ble.getGapState().connected)
{
temperatureDataCharacteristicBuffer = uBit.thermometer.getTemperature();