Skip to content
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

Remove using namespace directives in header #1496

Merged
merged 2 commits into from
Apr 12, 2024

Conversation

adamfidel
Copy link
Contributor

PR #1394 introduced a few using namespace directives in a header, which would pull everything from our internal namespaces to be visible in user code.

This PR removes the using directives by explicitly writing the namespaces and wrapping the forward declarations in their appropriate namespace.

Copy link
Contributor

@danhoeflinger danhoeflinger left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for putting this PR up.
@MikeDvorskiy should probably weigh in before merging.

namespace internal
{

enum class search_algorithm
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it really needed to have only one brick struct custom_brick + user visible enum class search_algorithm + parametrizations by their enum values? What about three bricks without enum class search_algorithm at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry, but I don't quite follow the question. I have updated the forward declaration of custom_brick to now use a forward declared search_algorithm enum class. Are you suggesting a different approach?

@@ -24,6 +24,8 @@
#ifndef _ONEDPL_SYCL_TRAITS_H
#define _ONEDPL_SYCL_TRAITS_H

#include <oneapi/dpl/internal/binary_search_extension_defs.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it should be a relative patch, via ""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed this include.

namespace internal
{

enum class search_algorithm
Copy link
Contributor

Choose a reason for hiding this comment

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

Why only a forward declaration is not enough?
Like this?
enum class search_algorithm;

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure that this enum required at all: see #1496 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not realize forward declaring enum classes were possible. Thanks for pointing that out. I have removed the changes to the binary search files and just forward declared the enum class.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK: forward declaration is enough too.
My idea was to split this brick into three separate bricks and remove this enum.
But I am fine with forward declaration too.

Copy link
Contributor

@SergeyKopienko SergeyKopienko left a comment

Choose a reason for hiding this comment

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

LGTM

@adamfidel adamfidel merged commit 2ca57e3 into main Apr 12, 2024
20 checks passed
@adamfidel adamfidel deleted the dev/adamfidel/device_copyable_namespace branch April 12, 2024 15:30
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.

4 participants