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

[clang] Follow-up on #embed implementation #95222

Open
1 of 8 tasks
Fznamznon opened this issue Jun 12, 2024 · 12 comments
Open
1 of 8 tasks

[clang] Follow-up on #embed implementation #95222

Fznamznon opened this issue Jun 12, 2024 · 12 comments
Labels
c23 clang:frontend Language frontend issues, e.g. anything involving "Sema" metabug Issue to collect references to a group of similar or related issues.

Comments

@Fznamznon
Copy link
Contributor

Fznamznon commented Jun 12, 2024

I merged #68620 this morning. However there are several places to improve the implementation. This issue is to track them as well as for further discussion on the matter.
To be done:

To be discussed

  • Decide how to handle -d, -E options
  • if _has_include/__has_embed/__has_c_attribute may appear in the limit parameter argument. Right now accepted, we may need to diagnose that.
  • What the default preprocessed output format should be, what options to provide to modify it.
  • Decide how to spell base64-input.

Please feel free to edit this if I got something wrong.

CC @AaronBallman @jyknight @cor3ntin @jakubjelinek

@Fznamznon Fznamznon added clang Clang issues not falling into any other category c23 clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jun 12, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2024

@llvm/issue-subscribers-clang-frontend

Author: Mariya Podchishchaeva (Fznamznon)

I merged https://github.com//pull/68620 this morning. However there are several places to improve the implementation. This issue is to track them as well as for further discussion on the matter. To be done:

To be discussed

  • Decide how to handle -d<letter>, -E options
  • if _has_include/__has_embed/__has_c_attribute may appear in the limit parameter argument. Right now accepted, we may need to diagnose that.
  • What the default preprocessed output format should be, what options to provide to modify it.
  • Decide how to spell base64-input.

Please feel free to edit this if I got something wrong.

CC @AaronBallman @jyknight @cor3ntin @jakubjelinek

@EugeneZelenko EugeneZelenko added metabug Issue to collect references to a group of similar or related issues. and removed clang Clang issues not falling into any other category labels Jun 12, 2024
@AaronBallman
Copy link
Collaborator

There are also some more follow-up concerns that were raised on the original PR, starting from #68620 (comment)

@Fznamznon
Copy link
Contributor Author

I posted a reland #95802 .

@R-Goc
Copy link
Contributor

R-Goc commented Jun 22, 2024

Is there a plan to implement a feature test macro for this? In the C++ paper, p1967, a feature test macro, __cpp_pp_embed is proposed. Or is there another way to check if embed is present for C++ that I missed, with some has_extension or has_feature macro?

@AaronBallman
Copy link
Collaborator

Is there a plan to implement a feature test macro for this? In the C++ paper, p1967, a feature test macro, __cpp_pp_embed is proposed. Or is there another way to check if embed is present for C++ that I missed, with some has_extension or has_feature macro?

In C, the feature test macro is __STDC_VERSION__; the feature has not yet been adopted in C++ and so we're in a bit of a holding pattern for what feature test macro we expose there.

@jakubjelinek
Copy link

Why do you need another feature test macro?
#ifdef __has_embed
or
#ifdef __has_embed
#if __has_embed(FILE)
should be enough for both C and C++.

@Fznamznon
Copy link
Contributor Author

I have created PR #97274 to address the second item in the TODO list (Transform tok::annot_embed into a bunch of tokens and inject them back into stream. We might need a new kind of token that directly hold a numerical value.)

@h-vetinari
Copy link
Contributor

Just noticed that #embed isn't mentioned under in the C23 section of the clang 19 release notes.

@AaronBallman
Copy link
Collaborator

Just noticed that #embed isn't mentioned under in the C23 section of the clang 19 release notes.

Good catch, the release note seems to have been dropped.

@Fznamznon
Copy link
Contributor Author

Just noticed that #embed isn't mentioned under in the C23 section of the clang 19 release notes.

Here it is #97997

@Fznamznon
Copy link
Contributor Author

Fznamznon commented Jul 23, 2024

Found one more bug via testing against gcc tests
https://godbolt.org/z/cffPqhfob
Also there is #97274 (comment) .

@Fznamznon
Copy link
Contributor Author

Fznamznon commented Jul 24, 2024

embed crash with std::initializer_list #99050 (comment) .
The crash itself can be fixed easily, but making clang accept the code seems more complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c23 clang:frontend Language frontend issues, e.g. anything involving "Sema" metabug Issue to collect references to a group of similar or related issues.
Projects
None yet
Development

No branches or pull requests

7 participants