Skip to content

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TESTS/mbedtls/ecp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "utest.h"
#include "rtos.h"

using namespace utest::v1;

Copy link
Contributor

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

Copy link
Author

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.

Copy link
Contributor

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

Copy link
Author

@mazimkhan mazimkhan Mar 30, 2017

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.

Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Author

Choose a reason for hiding this comment

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

Yes sure I agree.

#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
Expand All @@ -39,6 +37,8 @@ using namespace utest::v1;
#include <stdlib.h>
#endif

using namespace utest::v1;

#ifndef PUT_UINT32_BE
#define PUT_UINT32_BE(n,b,i) \
{ \
Expand Down