-
Notifications
You must be signed in to change notification settings - Fork 3k
Disambiguate utest::v1 types and remove using statement #4071
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
Disambiguate utest::v1 types and remove using statement #4071
Conversation
@@ -20,8 +20,6 @@ | |||
#include "utest.h" | |||
#include "rtos.h" | |||
|
|||
using namespace utest::v1; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have moved this statement to line 41, instead of removing it, after all the header file includes. In this way, this specific .c file would still be using the namespace, but it won't affect all the header files.
The issue was that this statement was before the header files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a good idea to use the using
statement as in future the test case might want to use the other status_t
type. And it would be ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your point, but in our specific case, status_t was platform specific, so there won't be a use for an other status_t
. My main concern is that if new tests will be introduced, one should also add the namsepcae prefix.
My comment wasn't a request for change, it was more of an obeservation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the other status_t
was also in a namespace then using using
on one might be ok. using namespace utest::v1
statement may not be a problem now but can be in future. Hence a maintenance thing.
Secondly, I didn't have partner code to verify the impact of moving the using
. Hence I went for a more robust approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with your approach, I only add a statement that future functions\types should also include the utest::v1
prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also discovered that status_t
is also defined in couple of targets and through some include path already available in the test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure I agree.
TESTS/mbedtls/selftest/main.cpp
Outdated
@@ -20,7 +20,6 @@ | |||
#include "utest.h" | |||
#include "rtos.h" | |||
|
|||
using namespace utest::v1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous comment.
I would have moved this statement to line 51, instead of removing it, after all the header file includes. In this way, this specific .c file would still be using the namespace, but it won't affect all the header files.
The issue was that this statement was before the header files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve this PR, however I haven't checked that all types that weren't added the utest::v1
namespace prefix don't need this prefix. It is important to add this prefix for future new tests\functions
@RonEld we don't have ensure by review if we missed scope resolution on any type after removing the |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
retest uvisor |
morph failure was due to a board's interface having issues, restarting now. /morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
retest uvisor |
@mazimkhan Please update to move the using statement after all the header inclusions as suggested by @RonEld |
@sg- I have removed the using statement altogether. Please see the discussion above. |
Yes but that solution doesn't follow how using is used in other mbed OS tests. All that should be required is moving the using statement below all headers |
@mazimkhan What do you think? |
@mazimkhan Occurrence to If new changes produce clash between symbols present in the global namespace and symbols in |
ecfe60e
to
ee1019d
Compare
Ok. Moved using statement instead of removing. |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@theotherjimmy why did you added this to release-version: 5.4.5 when the code is not on the master branch?? Removing the label... |
I did not see that. my bad. |
Notes:
Description
Removed using namespace utest::v1 and types from the namespace Ex: utest::v1::status_t. To avoid ambiguity with same name types.
Status
READY/IN DEVELOPMENT/HOLD
Migrations
If this PR changes any APIs or behaviors, give a short description of what API users should do when this PR is merged.
YES | NO
Related PRs
List related PRs against other branches:
Todos
Deploy notes
Notes regarding the deployment of this PR. These should note any
required changes in the build environment, tools, compilers, etc.
Steps to test or reproduce
Outline the steps to test or reproduce the PR here.
@RonEld @sbutcher-arm @andresag01 Please review.