Skip to content

Correctly include EventQueue.h #9801

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 1 commit into from
Mar 17, 2019
Merged

Correctly include EventQueue.h #9801

merged 1 commit into from
Mar 17, 2019

Conversation

vmedcy
Copy link
Contributor

@vmedcy vmedcy commented Feb 21, 2019

Description

There are two EventQueue.h in mbed-os codebase:
events/EventQueue.h
features/FEATURE_BLE/ble/pal/EventQueue.h

By accident, mbed compile generates includes.txt with the correct
order of include search paths. This is not the case for the CMake
exporter: targets with FEATURE_BLE enables fail to compile with errors:

mbed-os/features/cellular/framework/AT/ATHandler.h:99:60: error: 'events' has not been declared

Update all places to always include either "events/EventQueue.h"
or "ble/pal/EventQueue.h": to always find the correct header.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

There are two EventQueue.h in mbed-os codebase:
events/EventQueue.h
features/FEATURE_BLE/ble/pal/EventQueue.h

By accident, `mbed compile` generates includes.txt with the correct
order of include search paths. This is not the case for the CMake
exporter: targets with FEATURE_BLE enables fail to compile with errors:

mbed-os/features/cellular/framework/AT/ATHandler.h:99:60: error:
'events' has not been declared

Update all places to always include either "events/EventQueue.h"
or "ble/pal/EventQueue.h": to always find the correct header.
@vmedcy
Copy link
Contributor Author

vmedcy commented Feb 21, 2019

To reproduce, export to cmake any target with "features": ["BLE"] and build:

mbed export -i cmake_gcc-arm -m CY8CKIT_062_WIFI_BT
mkdir BUILD/cmake && cd BUILD/cmake
cmake ../../ -GNinja
ninja

typical C++ error:

In file included from mbed-os/features/cellular/framework/AT/AT_CellularBase.h:20:0,
                 from mbed-os/features/cellular/framework/AT/AT_CellularStack.h:21,
                 from mbed-os/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h:21,
                 from mbed-os/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp:19:
mbed-os/features/cellular/framework/AT/ATHandler.h:74:31: error: 'events' has not been declared
     ATHandler(FileHandle *fh, events::EventQueue &queue, uint32_t timeout, const char *output_delimiter, uint16_t send_delay = 0);
                               ^~~~~~
mbed-os/features/cellular/framework/AT/ATHandler.h:74:50: error: expected ',' or '...' before '&' token
     ATHandler(FileHandle *fh, events::EventQueue &queue, uint32_t timeout, const char *output_delimiter, uint16_t send_delay = 0);
                                                  ^
In file included from mbed-os/features/cellular/framework/AT/AT_CellularBase.h:20:0,
                 from mbed-os/features/cellular/framework/AT/AT_CellularStack.h:21,
                 from mbed-os/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h:21,
                 from mbed-os/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp:19:
mbed-os/features/cellular/framework/AT/ATHandler.h:99:60: error: 'events' has not been declared
     static ATHandler *get_instance(FileHandle *fileHandle, events::EventQueue &queue, uint32_t timeout,
                                                            ^~~~~~
mbed-os/features/cellular/framework/AT/ATHandler.h:99:79: error: expected ',' or '...' before '&' token
     static ATHandler *get_instance(FileHandle *fileHandle, events::EventQueue &queue, uint32_t timeout,
                                                                               ^
mbed-os/features/cellular/framework/AT/ATHandler.h:228:5: error: 'events' does not name a type; did you mean 'gets'?
     events::EventQueue &_queue;
     ^~~~~~
     gets

@cmonr cmonr requested review from geky and a team February 21, 2019 16:21
@paul-szczepanek-arm
Copy link
Member

I think it would be less error prone to have a unique name for the header: PalEventQueue.h (same as we have PalGap.h, PalGattClient.h). This is not a user facing header so will not break anyone's application.

Copy link

@deepikabhavnani deepikabhavnani left a comment

Choose a reason for hiding this comment

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

Looks good to me

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 22, 2019

I think it would be less error prone to have a unique name for the header: PalEventQueue.h (same as we have PalGap.h, PalGattClient.h). This is not a user facing header so will not break anyone's application.

@paul-szczepanek-arm Can you send PR fixing the name ?

@vmedcy
Copy link
Contributor Author

vmedcy commented Feb 22, 2019

@paul-szczepanek-arm, @0xc0170:

This is not a user facing header so will not break anyone's application.

Technically, there is no such thing as non-user-facing header, especially in mbed flow when ALL directories with headers are added to header search paths. I believe the correct solution for possible header name collisions is to consistently include everything as "module_name/header_name.h", and only add directories with modules to search paths. This is already done for most platform headers, but not currently enforced by the resource scanning rules.

@pan-
Copy link
Member

pan- commented Feb 25, 2019

@paul-szczepanek-arm Yes we can provide coherent naming for these headers. We need to discuss if we remove the Pal prefix on the header with it or add it to the headers without it. the inclusion pattern should be module/header. The main issue being IAR as the exporters doesn't work if two source files share the same name and we want shared name between source files and header files. @0xc0170 Do you know if this limitation stands with IAR 8.x ?

@vmedcy A header is considered not public if it is not part of the public API documentation. Of course technically you can include private headers in your application but that is a limitation of the tool not a desired behaviour.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 25, 2019

The main issue being IAR as the exporters doesn't work if two source files share the same name and we want shared name between source files and header files. @0xc0170 Do you know if this limitation stands with IAR 8.x ?

I dont, but @deepikabhavnani might or we test it.

@cmonr
Copy link
Contributor

cmonr commented Mar 1, 2019

@vmedcy @paul-szczepanek-arm @pan- @deepikabhavnani @0xc0170 Do we need to take a quick look at this and determine if it needs to go to 5.12?

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 1, 2019

@vmedcy @paul-szczepanek-arm @pan- @deepikabhavnani @0xc0170 Do we need to take a quick look at this and determine if it needs to go to 5.12?

Will get in CI when able, latest to 5.12.1

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 1, 2019

Ci scheduled

@mbed-ci
Copy link

mbed-ci commented Mar 1, 2019

Test run: FAILED

Summary: 1 of 14 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_tools-test

@cmonr
Copy link
Contributor

cmonr commented Mar 5, 2019

Info: This PR is good to go.

jenkins-ci/mbed-os-ci_tools-test was recently added, and didn't intend on being run against PRs just yet.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 12, 2019

Restarting CI (7 days ago the last run)

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 12, 2019

Aborted the job, need CI now for rc2 job asap, will restart later

@mbed-ci
Copy link

mbed-ci commented Mar 12, 2019

Test run: FAILED

Summary: 7 of 9 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARMC5
  • jenkins-ci/mbed-os-ci_mbed2-build-ARMC5
  • jenkins-ci/mbed-os-ci_mbed2-build-GCC_ARM
  • jenkins-ci/mbed-os-ci_mbed2-build-IAR8
  • jenkins-ci/mbed-os-ci_build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-IAR8
  • jenkins-ci/mbed-os-ci_build-ARMC6

@NirSonnenschein
Copy link
Contributor

restarting CI as CI resources currently available

@mbed-ci
Copy link

mbed-ci commented Mar 14, 2019

Test run: FAILED

Summary: 1 of 13 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_exporter

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 14, 2019

There's duplication in BLE , I dont think this relates to this PR, will restart to confirm and check how this happened

cmonr pushed a commit to cmonr/mbed-os that referenced this pull request Mar 16, 2019
cmonr pushed a commit to cmonr/mbed-os that referenced this pull request Mar 16, 2019
@cmonr cmonr merged commit dbb33ef into ARMmbed:master Mar 17, 2019
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.

8 participants