public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [GSoC][C++: Compiler Built-in Traits]: Example Impls & Small Patches
@ 2023-02-24 16:00 Ken Matsui
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Matsui @ 2023-02-24 16:00 UTC (permalink / raw)
  To: gcc

Hi,

My name is Ken Matsui. I am highly interested in contributing to the
project idea, "C++: Implement compiler built-in traits for the
standard library traits." To understand how to implement those traits,
could you please give me some example implementations of the compiler
built-in traits, as well as some recommended traits to get started
with making small patches?

Also, I would appreciate receiving the contact information for the
project mentor, Patrick Palka.

Sincerely,
Ken Matsui

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GSoC][C++: Compiler Built-in Traits]: Example Impls & Small Patches
  2023-02-27 22:01 Ken Matsui
@ 2023-02-28 15:50 ` Patrick Palka
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Palka @ 2023-02-28 15:50 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc

Hi Ken,

On Mon, Feb 27, 2023 at 5:02 PM Ken Matsui via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hi,
>
> My name is Ken Matsui. I am highly interested in contributing to the
> project idea, "C++: Implement compiler built-in traits for the
> standard library traits." To understand how to implement those traits,
> could you please give me some example implementations of the compiler
> built-in traits, as well as some recommended traits to get started
> with making small patches?

Awesome, thanks for your interest in this project, and welcome!

Most of the existing built-in traits are tabulated in
gcc/cp/cp-trait.def, and their logic is defined in finish_trait_type
or finish_trait_expr in gcc/cp/semantics.cc[2], and then the traits
are conditionally used in the standard type trait definitions in
libstdc++, e.g. std::remove_cv[3].

Take a look at the following commits that define (and add tests for)
the built-in traits __remove_cv, __remove_reference and __remove_cvref
and subsequently use them in libstdc++. Note that this first commit
predates the new gcc/cp/cp-trait.def file which streamlined much of
the boilerplate of adding a new built-in trait.  In the new approach
(that you would be using), only the semantics.cc change (which defines
their logic) would be needed, alongside additions to cp-trait.def to
declare each trait.
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9ca147154074a0de548138b4e73477e94903a855
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6ddbbbffbb5759a6c1d56c191364a6bd021f733e

To get started, I'd recommend implementing bulit-in traits for
std::remove_pointer, std::add_pointer and std::is_reference[4].  Let
me know if you have any questions :)

[1]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/cp/cp-trait.def
[2]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/cp/semantics.cc;h=79b7cc72f212cef780a3eea65af2b883bb4ec3c8;hb=HEAD#l12102
[3]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/std/type_traits;h=2bd607a8b8ff52aba6fd205ab1af2bc4b92f78d0;hb=HEAD#l1539
[4]: As specified in https://en.cppreference.com/w/cpp/header/type_traits

>
> Also, I would appreciate receiving the contact information for the
> project mentor, Patrick Palka.
>
> Sincerely,
> Ken Matsui


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [GSoC][C++: Compiler Built-in Traits]: Example Impls & Small Patches
@ 2023-02-27 22:01 Ken Matsui
  2023-02-28 15:50 ` Patrick Palka
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Matsui @ 2023-02-27 22:01 UTC (permalink / raw)
  To: gcc

Hi,

My name is Ken Matsui. I am highly interested in contributing to the
project idea, "C++: Implement compiler built-in traits for the
standard library traits." To understand how to implement those traits,
could you please give me some example implementations of the compiler
built-in traits, as well as some recommended traits to get started
with making small patches?

Also, I would appreciate receiving the contact information for the
project mentor, Patrick Palka.

Sincerely,
Ken Matsui

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-28 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 16:00 [GSoC][C++: Compiler Built-in Traits]: Example Impls & Small Patches Ken Matsui
2023-02-27 22:01 Ken Matsui
2023-02-28 15:50 ` Patrick Palka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).