Skip to content

Document code-emitting function-like macros - #6401

Open
ABWI-Y (ABWI-Y) wants to merge 4 commits into
microsoft:mainfrom
ABWI-Y:main
Open

ABWI-Y (ABWI-Y) wants to merge 4 commits into
microsoft:mainfrom
ABWI-Y:main

Conversation

@ABWI-Y

@ABWI-Y ABWI-Y (ABWI-Y) commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

<type_traits>: Document code-emitting function-like macros

This PR adds comments to document the code-emitting macros that used to live in
and now live in <type_traits>. These macros are used to stamp out
specializations for all the different calling conventions, cv/ref qualifiers,
and noexcept variations that we support.

These macros are kept around only for existing uses (see GH #2279 for why).
New code shouldn't rely on them.

Closes #348.

Copilot AI balanced review requested due to automatic review settings August 9, 2026 10:21
@ABWI-Y
ABWI-Y (ABWI-Y) requested a review from a team as a code owner August 9, 2026 10:21
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Aug 9, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Documents legacy code-emitting macros in <type_traits>.

Changes:

  • Explains calling-convention and qualifier expansion macros.
  • Records legacy usage guidance and rationale.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread stl/inc/type_traits Outdated
Comment on lines +387 to +388
// New code should not use these macros. They are kept only for existing
// specializations. (See GH #2279 for rationale.)
Comment thread stl/inc/type_traits Outdated

// _NON_MEMBER_CALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT)
// Emits FUNC for every supported non-member calling convention.
// Used to generate free-function specializations (e.g., std::function::operator()).
Comment thread stl/inc/type_traits Outdated
Comment on lines +505 to +509
// Used to define internal wrapper classes (e.g., in std::function)
// that vary by qualifier.
//
// This macro exists only for legacy specializations. New components
// (e.g., move_only_function) intentionally do not provide such coverage.
Comment thread stl/inc/type_traits Outdated
Comment on lines +458 to +460
// noexcept: (none) and noexcept, yielding 24 specializations; otherwise 12.
// Used by std::function, ptr_fun, and type traits to generate overloads
// that vary by calling convention.
Copilot AI review requested due to automatic review settings August 9, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 9, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

stl/inc/type_traits:447

  • This family-level description only documents _MEMBER_CALL; _MEMBER_CALL_CV, _MEMBER_CALL_CV_REF, and _MEMBER_CALL_CV_REF_NOEXCEPT remain unexplained even though documenting the code-emitting macros and their usage is the purpose of this change. Please mirror the non-member family’s qualifier-expansion comments and identify the final macro’s _Is_memfunptr use.
// Member calling convention family
// Same as _NON_MEMBER_CALL but also emits __thiscall on x86.

Copilot AI review requested due to automatic review settings August 9, 2026 12:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@frederick-vs-ja

Copy link
Copy Markdown
Contributor

<type_traits>: Document code-emitting function-like macros

This part should be the PR title.

@ABWI-Y

Copy link
Copy Markdown
Contributor Author

<type_traits>: Document code-emitting function-like macros

This part should be the PR title.

Thanks for pointing that out! I've updated the PR title accordingly.

@StephanTLavavej

Copy link
Copy Markdown
Member

You updated the PR description, not the PR title.

@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added the documentation Related to documentation or comments label Aug 15, 2026
@ABWI-Y ABWI-Y (ABWI-Y) changed the title Update comments per code review feedback Document code-emitting function-like macros Aug 15, 2026
@ABWI-Y

Copy link
Copy Markdown
Contributor Author

Oh,I'm sorry,I have updated it.

@ABWI-Y

Copy link
Copy Markdown
Contributor Author

Are there any other issues or feedback that need to be addressed? If not, could you please help merge this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Related to documentation or comments

Projects

Status: Initial Review

Development

Successfully merging this pull request may close these issues.

<xstddef>: document code-emitting function-like macros

4 participants