[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-03-07 Thread via cfe-commits

cor3ntin wrote:

https://github.com/llvm/llvm-project/pull/81658 replaces this PR

https://github.com/llvm/llvm-project/pull/80244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-03-07 Thread via cfe-commits

https://github.com/cor3ntin closed 
https://github.com/llvm/llvm-project/pull/80244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-02-24 Thread Collin Funk via cfe-commits

collinfunk wrote:

> Thank you for this PR. This change should have some tests to verify the 
> behavior is correct. I am a little surprised that this does not change any 
> existing tests but maybe we don't have good test coverage.

Hi, thanks for the review. Sorry for the lack of tests. I'm not super familiar 
with LLVM's code and didn't know how to add them. In any case, I believe that 
this issue was fixed in the following pull requests along with better 
Diagnostic groups:

https://github.com/llvm/llvm-project/pull/81658

Can you double check and make sure I am not mistaken? Thanks.


https://github.com/llvm/llvm-project/pull/80244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-02-23 Thread Shafik Yaghmour via cfe-commits

https://github.com/shafik commented:

Thank you for this PR. This change should have some tests to verify the 
behavior is correct. I am a little surprised that this does not change any 
existing tests but maybe we don't have good test coverage.

https://github.com/llvm/llvm-project/pull/80244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-01-31 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Collin Funk (collinfunk)


Changes

The C23 standard brought binary literals which were previously GNU extensions. 
Silence warnings from -Wgnu-binary-literal when using C23. This warning is 
implied by -Wpedantic.

---
Full diff: https://github.com/llvm/llvm-project/pull/80244.diff


1 Files Affected:

- (modified) clang/lib/Lex/LiteralSupport.cpp (+11-5) 


``diff
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 0a78638f68051..add4ca76678de 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -1358,11 +1358,17 @@ void 
NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
 
   // Handle simple binary numbers 0b01010
   if ((c1 == 'b' || c1 == 'B') && (s[1] == '0' || s[1] == '1')) {
-// 0b101010 is a C++1y / GCC extension.
-Diags.Report(TokLoc, LangOpts.CPlusPlus14
- ? diag::warn_cxx11_compat_binary_literal
- : LangOpts.CPlusPlus ? diag::ext_binary_literal_cxx14
-  : diag::ext_binary_literal);
+// 0b101010 is a GCC extension subsequently standardized by C23 and C++14.
+if (LangOpts.CPlusPlus) {
+  if (LangOpts.CPlusPlus14)
+Diags.Report(TokLoc, diag::warn_cxx11_compat_binary_literal);
+  else
+Diags.Report(TokLoc, diag::ext_binary_literal_cxx14);
+} else {
+  // TODO: Need new DiagGroup for C23.
+  if (!LangOpts.C23)
+Diags.Report(TokLoc, diag::ext_binary_literal);
+}
 ++s;
 assert(s < ThisTokEnd && "didn't maximally munch?");
 radix = 2;

``




https://github.com/llvm/llvm-project/pull/80244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-01-31 Thread via cfe-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/80244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostic] Don't warn about binary literals when using C23. (PR #80244)

2024-01-31 Thread Collin Funk via cfe-commits

https://github.com/collinfunk created 
https://github.com/llvm/llvm-project/pull/80244

The C23 standard brought binary literals which were previously GNU extensions. 
Silence warnings from -Wgnu-binary-literal when using C23. This warning is 
implied by -Wpedantic.

>From ef443507e06adcbc604ad8e03d96060e29525394 Mon Sep 17 00:00:00 2001
From: Collin Funk 
Date: Wed, 31 Jan 2024 21:30:39 -0800
Subject: [PATCH] [clang][Diagnostic] Don't warn about binary literals when
 using C23.

The C23 standard brought binary literals which were previously GNU
extensions. Silence warnings from -Wgnu-binary-literal when using C23.
This warning is implied by -Wpedantic.

Signed-off-by: Collin Funk 
---
 clang/lib/Lex/LiteralSupport.cpp | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 0a78638f68051..add4ca76678de 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -1358,11 +1358,17 @@ void 
NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
 
   // Handle simple binary numbers 0b01010
   if ((c1 == 'b' || c1 == 'B') && (s[1] == '0' || s[1] == '1')) {
-// 0b101010 is a C++1y / GCC extension.
-Diags.Report(TokLoc, LangOpts.CPlusPlus14
- ? diag::warn_cxx11_compat_binary_literal
- : LangOpts.CPlusPlus ? diag::ext_binary_literal_cxx14
-  : diag::ext_binary_literal);
+// 0b101010 is a GCC extension subsequently standardized by C23 and C++14.
+if (LangOpts.CPlusPlus) {
+  if (LangOpts.CPlusPlus14)
+Diags.Report(TokLoc, diag::warn_cxx11_compat_binary_literal);
+  else
+Diags.Report(TokLoc, diag::ext_binary_literal_cxx14);
+} else {
+  // TODO: Need new DiagGroup for C23.
+  if (!LangOpts.C23)
+Diags.Report(TokLoc, diag::ext_binary_literal);
+}
 ++s;
 assert(s < ThisTokEnd && "didn't maximally munch?");
 radix = 2;

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits