Skip to content

platform: fix internal platform headers #13459

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 3 commits into from
Aug 25, 2020

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Aug 18, 2020

Summary of changes

Note: I am using platform as a component with CMake, therefore include paths are set differently than with our build system (CMake is not including everything thus this is failing).

If we take platform as a component, platform/source would be outside of this component. I moved internal headers into internal folder.

Impact of changes

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[x] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


If we take platform as a component, platform/source would be outside of this component.
I removed the prefix as these are implementation specific (they are located in source folder,
not in include as the others).
@mergify mergify bot added the do not merge label Aug 18, 2020
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Aug 18, 2020
@ciarmcom ciarmcom requested review from a team August 18, 2020 15:00
@ciarmcom
Copy link
Member

@0xc0170, thank you for your changes.
@ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@LDong-Arm
Copy link
Contributor

LDong-Arm commented Aug 18, 2020

@0xc0170 Removing the prefix is the right thing to do - the library folder name is "unknown" to the code itself. 👍

I would rather move these to include, they are not source are they?

They are non-API internal headers, and the idea is to have them source. I guess in CMake we can define those headers to be private to "this" module?

If they are they should be moved then under source/platform/ rather to provide path as request or?

The reason we have include/platform/... is to expose include so users can do "namespaced" #include platform/.... But source and private headers are local to this module, so the namespace shouldn't be needed. It would be too cumbersome if all internal includes need the namespace despite being in the same library in my opinion.

But please let us know if the above assumption doesn't actually work easily with CMake.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 19, 2020

I found more offenders and even outside of platform component, I updated the above comment.. But will add it as well here:

Another error is (I haven't yet fixed it here as it is outside of platform component):

../mbed-os/events/source/equeue_mbed.cpp:41:10: fatal error: platform/source/mbed_os_timer.h: No such file or directory
  41 | #include "platform/source/mbed_os_timer.h"

Also mbed-os/rtos/source/Kernel.cpp and possibly other files, I'll find all once we agree how these should be done.

Events, rtos uses internal source files. The question now is - is t his really internal header , shouldn't it be moved to include/ folder and that would actually fix the issue I am seeing ?

@kjbracey
Copy link
Contributor

kjbracey commented Aug 19, 2020

That header is not supposed to be public API, but at some point equeue_mbed.cpp found itself needing to use some of the mbed::internal stuff inside them to work around a bug. Something of a hack.

Given that everything in the header I didn't want people to use in apps is namespaced as mbed::internal, it's notionally safe to expose pull if out of source and onto standard header path to permit the cross-call. Might need some extra "internal" Doxygen group marking, and maybe add an "internal/" onto the path if that's your current style.

@LDong-Arm
Copy link
Contributor

LDong-Arm commented Aug 19, 2020

Agree with @kjbracey-arm, moving mbed_os_timer.h to include/platform/internal/ complies with the new directory structure. (Well, #include platform/internal/mbed_os_timer.h would be doable by anyone due to how -I behaves, but "internal" is a good enough warning to users in my opinion.)

@0xc0170 0xc0170 changed the title WIP: platform: remove platform/ prefix for source platform: remove platform/ prefix for source Aug 20, 2020
@0xc0170 0xc0170 requested a review from hugueskamba August 20, 2020 07:52
@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 20, 2020

I moved 3 headers into internal "namespace" as mentioned above. Please review

@0xc0170 0xc0170 changed the title platform: remove platform/ prefix for source platform: fix internal platform headers Aug 20, 2020
@0xc0170 0xc0170 force-pushed the fix_platform_component branch from bd059b6 to d2013a3 Compare August 20, 2020 07:57
They belong to internal folder to follow our guideline, not in source as they were.
@0xc0170 0xc0170 force-pushed the fix_platform_component branch from d2013a3 to a6ce2c5 Compare August 20, 2020 07:58
@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 20, 2020

I've missed few more spots, updated

fix the typo

Co-authored-by: Lingkai Dong <[email protected]>
@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 21, 2020

CI started

@0xc0170 0xc0170 requested a review from LDong-Arm August 21, 2020 13:57
@mbed-ci
Copy link

mbed-ci commented Aug 21, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-ARM ✔️
jenkins-ci/mbed-os-ci_build-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 24, 2020

Travis restarted (this still needs reviews)

@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 25, 2020

ready for reviews again

Copy link
Contributor

@rajkan01 rajkan01 left a comment

Choose a reason for hiding this comment

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

LGTM

@adbridge adbridge merged commit b3c1922 into ARMmbed:master Aug 25, 2020
@mbedmain mbedmain added release-version: 6.3.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants