[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-06-30 Thread Richard Smith via cfe-commits
zygoloid wrote: (I guess we could also warn if an object-like macro is expanded and the macro name is preceded or followed by a `$` with no whitespace, since that would also behave differently under `-fdollars-in-identifiers`, but I suspect that's not worth worrying about in practice.) https:

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-06-30 Thread Richard Smith via cfe-commits
zygoloid wrote: > This will indeed break building the Linux kernel for x86_64 at least in my > brief test [...] > ``` > In file included from arch/x86/kernel/acpi/wakeup_64.S:11: > arch/x86/include/asm/nospec-branch.h:80:7: warning: '$' in identifier; did > you mean to enable '-fdollars-in-iden

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/6] Disable -fdollars-in-identifiers by default Clang used

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread James Y Knight via cfe-commits
jyknight wrote: > It appears that gcc only disallows '$' in identifiers in C++26 mode. Not sure > how relevant that is to clang. > [bugzilla](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343) Or am I > misreading that thread? As far as I can tell, GCC has _not_ disallowed '$' in identifier

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Effectively checking for `LangOpts.DollarIdents || LangOpts.AsmPreprocessor`? > Or do you think `DollarIdents` should be true if `AsmPreprocessor` is true? Neither. DollarIdents is already off by default in AsmPreprocessor mode. We should just preserve the existing beh

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: > We should disable the warning if we're preprocessing asm, which should mostly > solve the issue with warnings. Yes although the warnings from `arch/x86/include/asm/nospec-branch.h` do show up from `.c` files so that would only partially fix it. ``` In file included from

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > We should disable the warning if we're preprocessing asm, which should mostly > solve the issue with warnings. Effectively checking for `LangOpts.DollarIdents || LangOpts.AsmPreprocessor`? Or do you think `DollarIdents` should be true if `AsmPreprocessor` is true? https:

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We should disable the warning if we're preprocessing asm, which should mostly solve the issue with warnings. For the Linux kernel, does anything break other than the warnings? https://github.com/llvm/llvm-project/pull/135407 ___

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Nathan Chancellor via cfe-commits
nathanchance wrote: > CC @nathanchance @nickdesaulniers for more information This will indeed break building the Linux kernel for x86_64 at least in my brief test, mainly because it uses the preprocessor for assembly files but there are some macros that are included in both C and assembly that

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread via cfe-commits
R-Goc wrote: Doesn't the Linux kernel use it for syscall names? https://github.com/llvm/llvm-project/pull/135407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Doesn't the Linux kernel use it for syscall names? Might be wrong on this. CC @nathanchance @nickdesaulniers for more information, but even if the kernel does, is it a significant imposition to pass `-fdollars-in-identifiers` to enable the extension explicitly? https://g

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > It appears that gcc only disallows '$' in identifiers in C++26 mode. Not sure > how relevant that is to clang. > [bugzilla](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343) Or am I > misreading that thread? I get the same reading, but I am not certain we want to foll

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread via cfe-commits
R-Goc wrote: It appears that gcc only disallows '&' in identifiers in C++26 mode. Not sure how relevant that is to clang. [bugzilla](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343) https://github.com/llvm/llvm-project/pull/135407 ___ cfe-commits

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > If you don't want to do anything fancy, can you just add a warning in > Lexer::LexTokenInternal if we see a '$' (where we set the token type to > tok::unknown)? That should be easy to implement, and have zero impact on > lexer performance. Okay, that's pretty reasonable.

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/5] Disable -fdollars-in-identifiers by default Clang used

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread via cfe-commits
https://github.com/R-Goc edited https://github.com/llvm/llvm-project/pull/135407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread via cfe-commits
@@ -1,5 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fdollars-in-identifiers -fasm-blocks -emit-llvm -o - | FileCheck %s

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
@@ -7,7 +7,7 @@ #define foo`bar /* expected-error {{whitespace required after macro name}} */ #define foo2!bar /* expected-warning {{whitespace recommended after macro name}} */ -#define foo3$bar /* expected-error {{'$' in identifier}} */ +#define foo3$bar /* expected-er

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Shafik Yaghmour via cfe-commits
@@ -7,7 +7,7 @@ #define foo`bar /* expected-error {{whitespace required after macro name}} */ #define foo2!bar /* expected-warning {{whitespace recommended after macro name}} */ -#define foo3$bar /* expected-error {{'$' in identifier}} */ +#define foo3$bar /* expected-er

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If you don't want to do anything fancy, can you just add a warning in Lexer::LexTokenInternal if we see a '$' (where we set the token type to tok::unknown)? That should be easy to implement, and have zero impact on lexer performance. https://github.com/llvm/llvm-project/

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -1,5 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fdollars-in-identifiers -fasm-blocks -emit-llvm -o - | FileCheck %s

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -4036,6 +4036,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { LangOpts.MicrosoftExt = 1;// To get kw___try, kw___finally. LangOpts.DeclSpecKeyword = 1; // To get __declspec. LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed res

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > If we're going to do this, I think we need better diagnostics. Just > > straight disabling this is going to give very confusing diagnostics to > > anyone actually using dollar-signs in identifiers. > > Some ideas: > > ``` > > * We can give a warning if we see a "$" adjac

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/4] Disable -fdollars-in-identifiers by default Clang used

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-14 Thread Owen Pan via cfe-commits
@@ -4036,6 +4036,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { LangOpts.MicrosoftExt = 1;// To get kw___try, kw___finally. LangOpts.DeclSpecKeyword = 1; // To get __declspec. LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed res

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > If we're going to do this, I think we need better diagnostics. Just straight > disabling this is going to give very confusing diagnostics to anyone actually > using dollar-signs in identifiers. > > Some ideas: > > * We can give a warning if we see a "$" adjacent to a

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-14 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/3] Disable -fdollars-in-identifiers by default Clang used

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-12 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. THANKS! https://github.com/llvm/llvm-project/pull/135407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/135407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Richard Smith via cfe-commits
@@ -1,5 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fdollars-in-identifiers -fasm-blocks -emit-llvm -o - | FileCheck %s

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Richard Smith via cfe-commits
@@ -119,7 +119,7 @@ LANGOPT(WChar , 1, 0, "wchar_t keyword") LANGOPT(Char8 , 1, 0, "char8_t keyword") LANGOPT(IEEE128 , 1, 0, "__ieee128 keyword") LANGOPT(DeclSpecKeyword , 1, 0, "__declspec keyword") -BENIGN_LANGOPT(DollarIdents , 1, 1, "'

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Richard Smith via cfe-commits
https://github.com/zygoloid approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/135407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: If we're going to do this, I think we need better diagnostics. Just straight disabling this is going to give very confusing diagnostics to anyone actually using dollar-signs in identifiers. Some ideas: - We can give a warning if we see a "$" adjac

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/2] Disable -fdollars-in-identifiers by default Clang used

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Aaron Ballman (AaronBallman) Changes Clang used to enable -fdollars-in-identifiers by default for compatibility with GCC. However, this is no longer a conforming extension after WG21 P2558R2 and WG14 N2701. So this disables the dialect b

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/135407 Clang used to enable -fdollars-in-identifiers by default for compatibility with GCC. However, this is no longer a conforming extension after WG21 P2558R2 and WG14 N2701. So this disables the dialect by de