arduino / arduino/ArduinoCore-mbed

`-Wunused-variable` compiler warnings

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

Description

```
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp: In member function 'uint8_t STM32H747::readReg(uint8_t)':
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp:9:8: warning: unused variable 'response' [-Wunused-variable]
char response = 0xFF;
^~~~~~~~
In file included from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.h:29:0,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/stm32h7xx_hal_conf.h:398,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal.h:30,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:223,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/variants/OPTA/pinmode_arduino.h:24,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/Arduino.h:26,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.h:4,
from ~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp:1:
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp: In member function 'bool STM32H747::useInternalOscillator(bool)':
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_pwr.h:286:14: warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'
UNUSED(tmpreg); \
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_def.h:70:27: note: in definition of macro 'UNUSED'
#define UNUSED(x) ((void)(x))
^
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp:109:5: note: in expansion of macro '__HAL_PWR_VOLTAGESCALING_CONFIG'
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
^
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_pwr.h:286:14: warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'
UNUSED(tmpreg); \
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_def.h:70:27: note: in definition of macro 'UNUSED'
#define UNUSED(x) ((void)(x))
^
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp:111:5: note: in expansion of macro '__HAL_PWR_VOLTAGESCALING_CONFIG'
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
^
~/.arduino15/packages/arduino/hardware/mbed_opta/4.1.5/libraries/STM32H747_System/src/STM32H747_System.cpp:47:28: warning: unused variable 'PeriphClkInitStruct' [-Wunused-variable]
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
^~~~~~~~~~~~~~~~~~~
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in STM32H747_System.cpp, especially readReg(uint8_t) and useInternalOscillator(bool), using the compiler output to locate the unused variables and related macro warnings. Rebuild the mbed_opta target and confirm these -Wunused-variable and conversion warnings no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.