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

Finish Fixing Atomic Initialization #390

Merged
merged 6 commits into from
Jan 24, 2020

Conversation

AdamBucior
Copy link
Contributor

@AdamBucior AdamBucior commented Dec 16, 2019

Description

Resolves #336. The only problem is that I don't know how to signal deprecation of ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT macros.

Checklist

Be sure you've read README.md and understand the scope of this repo.

If you're unsure about a box, leave it unchecked. A maintainer will help you.

  • Identifiers in product code changes are properly _Ugly as per
    https://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
  • The STL builds successfully and all tests have passed (must be manually
    verified by an STL maintainer before automated testing is enabled on GitHub,
    leave this unchecked for initial submission).
  • These changes introduce no known ABI breaks (adding members, renaming
    members, adding virtual functions, changing whether a type is an aggregate
    or trivially copyable, etc.).
  • These changes were written from scratch using only this repository,
    the C++ Working Draft (including any cited standards), other WG21 papers
    (excluding reference implementations outside of proposed standard wording),
    and LWG issues as reference material. If they were derived from a project
    that's already listed in NOTICE.txt, that's fine, but please mention it.
    If they were derived from any other project (including Boost and libc++,
    which are not yet listed in NOTICE.txt), you must mention it here,
    so we can determine whether the license is compatible and what else needs
    to be done.

@AdamBucior AdamBucior requested a review from a team as a code owner December 16, 2019 16:24
@codicodi
Copy link
Contributor

You can generate a message on macro use like this:

#define HELLO_DEPRECATION_WARNING __pragma(message ("Warning: HELLO is deprecated"))
#define HELLO HELLO_DEPRECATION_WARNING "Hello"

It doesn't count as a warning from compiler's perspective though (doesn't turn into error with /WX or -Werror).

@sylveon
Copy link
Contributor

sylveon commented Dec 16, 2019

You can use a type to differentiate the use of the ATOMIC_*_INIT operators/constructors, and then deprecate those: https://godbolt.org/z/anYSGd

Copy link
Member

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

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

We need to ensure that test coverage is similarly made unconditional (we currently have Clang-only test coverage). Perhaps more importantly, we need a test to validate that C1XX correctly constant-initializes at least atomic<int>, atomic<bytes<3>>, atomic<bytes<23>>, and atomic_flag.

(I'm personally not disturbed by the inability to annotate the macros as deprecated.)

stl/inc/yvals_core.h Outdated Show resolved Hide resolved
AdamBucior and others added 2 commits December 16, 2019 20:18
Co-Authored-By: Casey Carter <cartec69@gmail.com>
@BillyONeal
Copy link
Member

I agree we don't need to bend over backwards to mark the macro as deprecated.

@BillyONeal
Copy link
Member

@CaseyCarter AFAIK the compiler that ships with 2019 16.5 Preview 2 should have that fixed, so I think we can merge this as soon as that ships.

@BillyONeal BillyONeal self-assigned this Dec 17, 2019
Copy link
Member

@StephanTLavavej StephanTLavavej left a comment

Choose a reason for hiding this comment

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

This looks great to me! While I'm the staunchest advocate of emitting deprecation warnings, I believe that attempting to do so for the macros would be more trouble than it's worth.

Merging should wait for VS 2019 16.5 Preview 2's release due to the compiler bugfix dependency.

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

Internal tests passed. Will merge as soon as 2019 16.5 Preview 2 is available.

@BillyONeal BillyONeal added the blocked Something is preventing work on this label Dec 17, 2019
@BillyONeal BillyONeal removed the blocked Something is preventing work on this label Jan 23, 2020
@BillyONeal BillyONeal merged commit a46d897 into microsoft:master Jan 24, 2020
@BillyONeal
Copy link
Member

Thanks for your contribution!

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.

P0883R2 Fixing Atomic Initialization
6 participants