Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Update C standard to GNU11, C++ to GNU++14 #17114

Merged
merged 1 commit into from
Jun 5, 2022

Conversation

KarlK90
Copy link
Member

@KarlK90 KarlK90 commented May 16, 2022

Description

Pushes the used C standard for QMK to GNU11 and C++ standard to GNU17.

GCC support on QMK platfroms

Platform AVR GCC Version Embedded ARM GCC Version AMD64 GCC Version
Windows 8.4.0 (MSYS2) 10.1 (MSYS2) 11.3.0 (MSYS2)
MacOS 8.4.0 (Homebrew) 8.4.0 (Homebrew) 12.1.0 (Homebrew)
FreeBSD 11.2.0 (12 + 13) 8.4.0 (12) 11.3.0 (13) 12.1.0 (13) 11.2.0 (12)
WSL2 8.3.0 (QMK base container) 8.3.1 (QMK base container) 10.2.1 (QMK base container)
Arch 12.1.0 (Arch Packages) 12.1.0 (Arch Packages) 12.1.0 (Arch Packages)
Manjaro 12.1.0 (Arch Packages) 12.1.0 (Arch Packages) 12.1.0 (Arch Packages)
Fedora 12.2.0 (36), 11.1.0 (35), 10.2.0 (34) 11.1.0 (36) 11.1.0 (35) 10.2.0 (34) 12.0.1 (36) 11.2.1 (35) 11.0.1 (34)
Ubuntu 5.4.0 (22.04 LTS + 20.04 LTS + 18.04 LTS) 10.3.0 (22.04 LTS) 9.2.1 (20.04 LTS) 6.3.1 (18.04 LTS) 11.2.0 (22.04 LTS) 9.3.0 (20.04 LTS) 7.3.0 (18.04 LTS)
Debian 5.4.0 (Sid + 11 + 10) 10.3.0 (Sid) 8.3.1 (11) 7.3.1 (10) 11.2.0 (Sid) 10.2.1 (11) 8.3.0 (10)
Gentoo 10.3.0+ (sys-devel/gcc) 10.3.0+ (sys-devel/gcc) 10.3.0+ (sys-devel/gcc)
Sabayon 10.3.0+ (sys-devel/gcc) 10.3.0+ (sys-devel/gcc) 10.3.0+ (sys-devel/gcc)
openSUSE Tumbleweed 5.4.0 (Experimental) / 6.5.0 (Community) 12.1.1 12.1.1
openSUSE Leap 15.3 10.3.0 (Community) 12.1.1 12.1.1
Slackware 10.2.0 (15.0) 10.2.0 (15.0) 11.3.0
Solus 8.3.0 8.3.0 11.3.0
Void 9.3.0 9.3.0 10.2.1
Target Minimum version QMK CI
AMD64 7.3.0 10.2.1
AVR 5.4.0 8.3.0
ARM 6.3.1 8.3.1
Lang. standard GCC support
C11 4.9+ (complete)
C17 8.1+ (complete)
C++14 5.x+ (complete)
C++17 8.x+ (complete)
C++20 11.x+ (partial)
C++23 12.x+ (partial)

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@zvecr
Copy link
Member

zvecr commented May 16, 2022

It would be nice to get some insight into potential impact, like was handled in #7920. Slightly more complicated, due to needing to check avr/arm/native compiler versions?

@tzarc
Copy link
Member

tzarc commented May 16, 2022

Probably worth bumping C++ standard, too.

@KarlK90
Copy link
Member Author

KarlK90 commented May 17, 2022

Isn't c++ already on gnu11?

@tzarc
Copy link
Member

tzarc commented May 17, 2022

I thought we discussed going to 14 on one of your previous PRs for unit tests?

@KarlK90
Copy link
Member Author

KarlK90 commented May 17, 2022

I thought we discussed going to 14 on one of your previous PRs for unit tests?

Ah yes, even 17 if I remember correctly. How are the constraints regarding default OS availability here? I suspect that somebody who is able to write a unit-test should be able to update to a recent GCC version.

@KarlK90 KarlK90 force-pushed the feature/push-c-to-gnu11 branch 2 times, most recently from c656b1d to 4830e34 Compare May 31, 2022 19:48
@KarlK90 KarlK90 force-pushed the feature/push-c-to-gnu11 branch from 4830e34 to a305409 Compare May 31, 2022 19:49
@github-actions github-actions bot removed the keyboard label May 31, 2022
@KarlK90
Copy link
Member Author

KarlK90 commented May 31, 2022

I have updated the GCC compatibility table to cover AVR, ARM and AMD64 targets for all QMK platforms. We can safely update to GNU11 for C and GNU14 for C++.

The only CPP code which is not test code is the USB HID converter which is used by converters like the adb_usb and usb_usb converters. We could upgrade the test code to GNU17 and potentially use new language features in the tests. This should be possible as the testes are run by the CI and experienced users which should have a up to date GCC by default on most distros. The CPP standard for AVR/ARM/RISC-V targets would remain at GNU14 as the minimum AVR compiler version is 5.4.0.

@KarlK90 KarlK90 requested review from a team and removed request for a team May 31, 2022 19:56
@tzarc tzarc changed the title [Core] Update C standard to GNU11 [Core] Update C standard to GNU11, C++ to GNU++14 Jun 5, 2022
@tzarc tzarc merged commit e89478e into qmk:develop Jun 5, 2022
0xcharly pushed a commit to Bastardkb/bastardkb-qmk that referenced this pull request Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants