Skip to content

Commit 4890261

Browse files
authored
Merge pull request #4548 from deepikabhavnani/os_warn
Resolve Warnings for mbed-os-examples
2 parents 28df3ae + 7e9ea9c commit 4890261

File tree

10 files changed

+30
-26
lines changed

10 files changed

+30
-26
lines changed

drivers/CAN.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void donothing() {}
2626
CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
2727
// No lock needed in constructor
2828

29-
for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
29+
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
3030
_irq[i] = callback(donothing);
3131
}
3232

@@ -37,7 +37,7 @@ CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
3737
CAN::CAN(PinName rd, PinName td, int hz) : _can(), _irq() {
3838
// No lock needed in constructor
3939

40-
for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
40+
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
4141
_irq[i].attach(donothing);
4242
}
4343

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/lpc17_emac.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void lpc_rxqueue_pbuf(struct lpc_enetdata *lpc_enetif, struct pbuf *p)
192192
LPC_EMAC->RxConsumeIndex = idx;
193193

194194
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
195-
("lpc_rxqueue_pbuf: pbuf packet queued: %p (free desc=%d)\n", p,
195+
("lpc_rxqueue_pbuf: pbuf packet queued: %p (free desc=%"U32_F")\n", p,
196196
lpc_enetif->rx_free_descs));
197197
}
198198

@@ -215,7 +215,7 @@ s32_t lpc_rx_queue(struct netif *netif)
215215
p = pbuf_alloc(PBUF_RAW, (u16_t) EMAC_ETH_MAX_FLEN, PBUF_RAM);
216216
if (p == NULL) {
217217
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
218-
("lpc_rx_queue: could not allocate RX pbuf (free desc=%d)\n",
218+
("lpc_rx_queue: could not allocate RX pbuf (free desc=%"U32_F")\n",
219219
lpc_enetif->rx_free_descs));
220220
return queued;
221221
}
@@ -341,7 +341,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
341341
lpc_rxqueue_pbuf(lpc_enetif, p);
342342

343343
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
344-
("lpc_low_level_input: Packet dropped with errors (0x%x)\n",
344+
("lpc_low_level_input: Packet dropped with errors (%"X32_F")\n",
345345
lpc_enetif->prxs[idx].statusinfo));
346346

347347
p = NULL;
@@ -365,10 +365,10 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
365365

366366
/* Re-queue the pbuf for receive */
367367
p->len = origLength;
368-
lpc_rxqueue_pbuf(lpc_enetif, p);
368+
lpc_rxqueue_pbuf(lpc_enetif, p);
369369

370370
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
371-
("lpc_low_level_input: Packet index %d dropped for OOM\n",
371+
("lpc_low_level_input: Packet index %"U32_F" dropped for OOM\n",
372372
idx));
373373

374374
#ifdef LOCK_RX_THREAD
@@ -381,7 +381,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
381381
}
382382

383383
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
384-
("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n",
384+
("lpc_low_level_input: Packet received: %p, size %"U32_F" (index=%"U32_F")\n",
385385
p, length, idx));
386386

387387
/* Save size */
@@ -479,7 +479,7 @@ static void lpc_tx_reclaim_st(struct lpc_enetdata *lpc_enetif, u32_t cidx)
479479
while (cidx != lpc_enetif->lpc_last_tx_idx) {
480480
if (lpc_enetif->txb[lpc_enetif->lpc_last_tx_idx] != NULL) {
481481
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
482-
("lpc_tx_reclaim_st: Freeing packet %p (index %d)\n",
482+
("lpc_tx_reclaim_st: Freeing packet %p (index %"U32_F")\n",
483483
lpc_enetif->txb[lpc_enetif->lpc_last_tx_idx],
484484
lpc_enetif->lpc_last_tx_idx));
485485
pbuf_free(lpc_enetif->txb[lpc_enetif->lpc_last_tx_idx]);
@@ -646,8 +646,8 @@ static err_t lpc_low_level_output(struct netif *netif, struct pbuf *p)
646646
}
647647

648648
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
649-
("lpc_low_level_output: pbuf packet(%p) sent, chain#=%d,"
650-
" size = %d (index=%d)\n", q->payload, dn, q->len, idx));
649+
("lpc_low_level_output: pbuf packet(%p) sent, chain#=%"S32_F","
650+
" size = %d (index=%"U32_F")\n", q->payload, dn, q->len, idx));
651651

652652
lpc_enetif->ptxd[idx].packet = (u32_t) q->payload;
653653

features/storage/FEATURE_STORAGE/cfstore/source/configuration_store.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,7 @@ static int32_t cfstore_delete_ex(cfstore_area_hkvt_t* hkvt)
23922392
memset(ctx->area_0_tail-kv_size, 0, kv_size);
23932393

23942394
/* The KV area has shrunk so a negative size_diff should be indicated to cfstore_file_update(). */
2395-
ret = cfstore_file_update(hkvt->head, -1 * kv_size);
2395+
ret = cfstore_file_update(hkvt->head, -1 *(int32_t)kv_size);
23962396
if(ret < ARM_DRIVER_OK){
23972397
CFSTORE_ERRLOG("%s:Error:file update failed\n", __func__);
23982398
goto out0;

platform/mbed_mktime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ time_t _rtc_mktime(const struct tm* time) {
105105
}
106106

107107
if (result > INT32_MAX) {
108-
return -1;
108+
return (time_t) -1;
109109
}
110110

111111
return result;

platform/mbed_rtc_time.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ time_t time(time_t *timer)
5353
}
5454
}
5555

56-
time_t t = -1;
56+
time_t t = (time_t)-1;
5757
if (_rtc_read != NULL) {
5858
t = _rtc_read();
5959
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/drivers/fsl_flash.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static void (*callFlashCommonBitOperation)(FTFx_REG32_ACCESS_TYPE base,
402402
* @endcode
403403
* Note2: The binary code is generated by IAR 7.70.1
404404
*/
405-
const static uint16_t s_flashRunCommandFunctionCode[] = {
405+
static const uint16_t s_flashRunCommandFunctionCode[] = {
406406
0x2180, /* MOVS R1, #128 ; 0x80 */
407407
0x7001, /* STRB R1, [R0] */
408408
/* @4: */
@@ -432,7 +432,7 @@ const static uint16_t s_flashRunCommandFunctionCode[] = {
432432
* @endcode
433433
* Note2: The binary code is generated by IAR 7.70.1
434434
*/
435-
const static uint16_t s_flashCommonBitOperationFunctionCode[] = {
435+
static const uint16_t s_flashCommonBitOperationFunctionCode[] = {
436436
0xb510, /* PUSH {R4, LR} */
437437
0x2900, /* CMP R1, #0 */
438438
0xd005, /* BEQ.N @12 */
@@ -2734,11 +2734,12 @@ void flash_cache_clear(flash_config_t *config)
27342734
__DSB();
27352735
#endif /* FLASH_DRIVER_IS_FLASH_RESIDENT */
27362736
}
2737+
#if (defined(__GNUC__))
2738+
/* #pragma GCC pop_options */
2739+
#else
27372740
#if (defined(__CC_ARM))
27382741
#pragma pop
27392742
#endif
2740-
#if (defined(__GNUC__))
2741-
/* #pragma GCC pop_options */
27422743
#endif
27432744

27442745
#if FLASH_DRIVER_IS_FLASH_RESIDENT

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/drivers/fsl_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ void DisableDeepSleepIRQ(IRQn_Type interrupt)
158158
DisableIRQ(interrupt); /* also disable interrupt at NVIC */
159159
/* SYSCON->STARTERCLR[index] = 1u << intNumber; */
160160
}
161-
#endif /*CPU_QN908X */
161+
#endif /*CPU_QN908X */

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/drivers/fsl_enet.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,8 @@ void ENET_Init(ENET_Type *base,
316316
assert(bufferConfig->rxBufferAlign);
317317
assert(macAddr);
318318

319-
uint32_t instance = ENET_GetInstance(base);
320-
321319
#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
320+
uint32_t instance = ENET_GetInstance(base);
322321
/* Ungate ENET clock. */
323322
CLOCK_EnableClock(s_enetClock[instance]);
324323
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
@@ -413,7 +412,7 @@ static void ENET_SetMacController(ENET_Type *base,
413412
uint32_t tcr = 0;
414413
uint32_t ecr = 0;
415414
uint32_t macSpecialConfig = config->macSpecialConfig;
416-
uint32_t instance = ENET_GetInstance(base);
415+
ENET_GetInstance(base);
417416

418417
/* Configures MAC receive controller with user configure structure. */
419418
rcr = ENET_RCR_NLC(!!(macSpecialConfig & kENET_ControlRxPayloadCheckEnable)) |

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/drivers/fsl_flash.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static void (*callFlashCommonBitOperation)(FTFx_REG32_ACCESS_TYPE base,
402402
* @endcode
403403
* Note2: The binary code is generated by IAR 7.70.1
404404
*/
405-
const static uint16_t s_flashRunCommandFunctionCode[] = {
405+
static const uint16_t s_flashRunCommandFunctionCode[] = {
406406
0x2180, /* MOVS R1, #128 ; 0x80 */
407407
0x7001, /* STRB R1, [R0] */
408408
/* @4: */
@@ -432,7 +432,7 @@ const static uint16_t s_flashRunCommandFunctionCode[] = {
432432
* @endcode
433433
* Note2: The binary code is generated by IAR 7.70.1
434434
*/
435-
const static uint16_t s_flashCommonBitOperationFunctionCode[] = {
435+
static const uint16_t s_flashCommonBitOperationFunctionCode[] = {
436436
0xb510, /* PUSH {R4, LR} */
437437
0x2900, /* CMP R1, #0 */
438438
0xd005, /* BEQ.N @12 */
@@ -2734,11 +2734,12 @@ void flash_cache_clear(flash_config_t *config)
27342734
__DSB();
27352735
#endif /* FLASH_DRIVER_IS_FLASH_RESIDENT */
27362736
}
2737+
#if (defined(__GNUC__))
2738+
/* #pragma GCC pop_options */
2739+
#else
27372740
#if (defined(__CC_ARM))
27382741
#pragma pop
27392742
#endif
2740-
#if (defined(__GNUC__))
2741-
/* #pragma GCC pop_options */
27422743
#endif
27432744

27442745
#if FLASH_DRIVER_IS_FLASH_RESIDENT

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ void hal_sleep(void)
2828
void hal_deepsleep(void)
2929
{
3030
#if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT)
31+
#if defined(kMCG_ModePEE)
3132
mcg_mode_t mode = CLOCK_GetMode();
3233
#endif
34+
#endif
35+
3336
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
3437

3538
SMC_SetPowerModeVlps(SMC);

0 commit comments

Comments
 (0)