Skip to content

register storage class specifier causes -Wregister warnings when compiled as C++17 (stm32c0xx_ll_adc.h, stm32c0xx_ll_rtc.h) #7

@eos1d3

Description

@eos1d3

Caution
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum

Describe the set-up

Custom board using STM32C011F6Px
GNU Tools for STM32 (13.3.rel1) — arm-none-eabi-g++ with -std=gnu++17
Describe the bug
Eight uses of the register storage class specifier remain in the LL driver headers. The register keyword is deprecated in C++11 and removed in C++17; any project compiled with -std=c++17 or -std=gnu++17 receives a warning (treated as an error with -Werror):

Affected locations:
Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_ll_adc.h
line 4010, 4115, 4120

Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_ll_rtc.h
line 1077, 1105, 1410, 1438, 1741

How To Reproduce

Create any C++ project targeting STM32C0 that includes stm32c0xx_ll_adc.h or stm32c0xx_ll_rtc.h and calls the affected LL functions.
Compile with -std=c++17 (or -std=gnu++17).
The compiler emits [-Wregister] warnings for each of the eight lines listed above.

Additional context
The fix is straightforward — remove the register keyword from the eight variable declarations. The qualifier has had no effect on code generation in modern compilers for many years.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghalHardware Abstraction Layerinternal bug trackerIssue confirmed and logged into the internal bug tracking systemrtcReal-Time Clock

Type

Projects

Status

Analyzed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions