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

Change #pragma once to include guards. #2372

Conversation

mordante
Copy link
Contributor

@mordante mordante commented Dec 3, 2021

Libc++ uses include guards instead of #pragma once. This change
makes it easier for libc++ to sync with MSVC STL.

Libc++ uses include guards instead of #pragma once. This change
makes it easier for libc++ to sync with MSVC STL.
@mordante mordante requested a review from a team as a code owner December 3, 2021 18:40
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Dec 3, 2021
@mordante
Copy link
Contributor Author

mordante commented Dec 3, 2021

@StephanTLavavej As discussed privately on Discord here the PR for the charconv tests.

@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef TEST_HPP
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This filename is quite short to the include guard isn't too unique.
Since MSVC STL uses #pragma once in their other tests there's no conflict with the other test.hpp files.
At libc++'s side and it's no issue there.

Are you happy with this short name or should I include the directory name? In that case I think it makes sense to do that to all files just to be consistent.

Copy link
Member

@CaseyCarter CaseyCarter Dec 3, 2021

Choose a reason for hiding this comment

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

This is very short, but I didn't complain since the scope of these headers is just this single test. If test.hpp is a sufficiently-descriptive name, then TEST_HPP is almost certainly a sufficiently-unique header guard macro.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fine by me. I wanted to point out this short name so it the attention of the reviewers. Thanks for the review!

@StephanTLavavej StephanTLavavej added test Related to test code and removed enhancement Something can be improved labels Dec 4, 2021
@StephanTLavavej StephanTLavavej self-assigned this Dec 8, 2021
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 9cfcf56 into microsoft:main Dec 9, 2021
@StephanTLavavej
Copy link
Member

Thanks for increasing the alignment of our codebases, and for your heroic efforts to add floating-point to_chars() to libc++! 😻 ✔️ 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Related to test code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants