Skip to content

Remove forceful "using namespace arduino" from headers #144

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

Merged
merged 2 commits into from
Apr 6, 2021

Conversation

facchinm
Copy link
Member

First step to fix arduino/ArduinoCore-samd#606

Copy link

@bxparks bxparks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, This is great news. The explicit using statements seem to provide backwards compatibility with existing forward declarations. As noted above, I had to add the using arduino::String statement to make the fix more complete.

I validated your 2 PRs,

by switching my git repos to your branches (so basically, I get a samd 1.8.11, plus your changes). I then compiled and uploaded about 70 of my unit tests, across most of my libraries, to an actual MKR1000 that I recently purchased. I had a few hiccups, but eventually got everything working.

There were 3 classes of problems:

  1. String forward declarations, fixed by above.
  2. More stringent compiler errors and warnings from the SAMD21 compiler. (Every compiler seems to complain about slightly different things...)
  3. The breaking change to ::digitalWrite(uint8_t, uint8_t) which is now ::digitalWrite(uint8_t, PinStatus) in the new API.
    • I have to use an explicitly scoped ::digitalWrite() because I have an overloaded digitalWrite() in that class. But ::digitalWrite() does not match your arduino::digitalWrite()) overload. So I had to insert a handful of #if defined(ARDUINO_API_VERSION) statements.

With regards to the 2 PR on my libraries:

I will check in a version that removes that #error for the SAMD21 core. But I want to retain the blacklist for megaAVR platform until I personally verify that arduino/ArduinoCore-megaavr#62 is fixed on actual hardware. I currently don't have any megaAVR boards, but it's on my shopping list.

I have a question on bxparks/AceTime#57 that you sent: You replaced the #include <Arduino.h> with an #include <arvr/pgmspace.h>. Unfortunately, that breaks the ESP32 platform, where it needs to be #include <pgmspace.h>. I can add some conditional code on ARDUINO_API_VERSION in there, or just keep using #include <Arduino.h> in that .cpp file.

I will update this comment when I have submitted the fixes on my end that adds support for arduino:samd >= 1.8.10.

@bxparks
Copy link

bxparks commented Apr 2, 2021

I have prepared a series of PRs, which replace the PRs sent to me by @facchinm:

These are designed to reenable arduino:samd when a new version (1.8.12?) is released. The version number of the arduino:samd Core doesn't matter. Instead, I assume that the ARDUINO_API_VERSION number will be incremented for the next release.

I will wait until the new arduino:samd core is pushed out. Then I will re-validate my libraries, and if everything looks right, I will submit my PRs listed above, and everything should be stable again. We can undo the version-pinning of my libraries (arduino/ArduinoCore-samd#607) in the arduino:samd CI workflow if desired.

@facchinm facchinm force-pushed the no_forced_namespace branch from d6a2632 to db53d3d Compare April 6, 2021 13:37
@facchinm facchinm force-pushed the no_forced_namespace branch from 3f4fd3a to f66d9dc Compare April 6, 2021 13:44
@facchinm facchinm merged commit 4baf42c into arduino:master Apr 6, 2021
umaplehurst pushed a commit to umaplehurst/ArduinoCore-samd that referenced this pull request Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AceTime example compilation is breaking checks
2 participants