esp8266 / esp8266/Arduino

C++20 compatibility: a lot of warnings

Open
#8,916 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

### Basic Infos

- [x] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).
- [x] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.
- [ ] I have tested that the issue is present in current master branch (aka latest git).
- [x] I have searched the issue tracker for a similar issue.
- [x] If there is a stack dump, I have decoded it.
- [x] I have filled out all fields below.

#### Platform

- Hardware: [ESP-8266]
- Core Version: [v3.0.2]
- Development Env: [Platformio]
- Operating System: [MacOS]

### Settings in IDE

- Module: [nodemcuv2]

### Problem Description

I've set a flag to compile with the latest (available) standard: `-std=gnu++20`.

It works, but it produces a lot of warnings, for example:

```
.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_si2c.cpp:576:33: warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
576 | twi_data = twi_txBuffer[twi_txBufferIndex++];
| ^~~~~~~~~~~~~~~~~
.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_si2c.cpp:579:9: warning: '--' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
579 | bitCount--;
| ^~~~~~~~
.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_si2c.cpp:588:18: warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
588 | twi_data <<= 1;
| ~~~~~~~~~^~~~~
.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_si2c.
```

They are all connected to the fact that starting with C++20, some of the `volatile` operations are deprecated: https://blog.feabhas.com/2021/05/modern-embedded-c-deprecation-of-volatile/

1. Is there a plan for better support of C++20?
2. Are you open for PRs in this matter?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.