-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][COMPAT] Move clashing functions into anonymous namespace (#15446)
Some `syclcompat::` functions clash with global namespace (C-style) functions because of Argument Dependent Lookup. These are: - `memcpy` - `memset` - `free` - `fill` To prevent ADL from finding these functions, they have been moved into an anonymous namespace.
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*************************************************************************** | ||
* | ||
* Copyright (C) Codeplay Software Ltd. | ||
* | ||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM | ||
* Exceptions. See https://llvm.org/LICENSE.txt for license information. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SYCLcompat API | ||
* | ||
* memory_adl.cpp | ||
* | ||
* Description: | ||
* Tests to ensure global namespace functions don't clash via ADL | ||
**************************************************************************/ | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -fsyntax-only | ||
// Test that no syclcompat:: functions clash with global namespace fns due to ADL | ||
#include <sycl/sycl.hpp> | ||
#include <syclcompat/syclcompat.hpp> | ||
|
||
int main(){ | ||
syclcompat::device_info dummy_info; | ||
syclcompat::device_info dummy_info_2; | ||
memset(&dummy_info, 0, sizeof(syclcompat::device_info)); | ||
memcpy(&dummy_info, &dummy_info_2, sizeof(syclcompat::device_info)); | ||
free(&dummy_info); | ||
} |