AaronBallman wrote:
> this causes a `-Wmicrosoft-goto` warning on
>
> ```
> $ cat /tmp/a.c
> void f() {
> goto l;
> int i = 0;
> l:
> }
> $ bin/clang-cl /c /tmp/a.c
> ...
> /tmp/a.c(2,2): warning: jump from this goto statement to its label is a
> Microsoft extension [-Wmicrosoft
zmodem wrote:
> this causes a `-Wmicrosoft-goto` warning on [...]
Sent https://github.com/llvm/llvm-project/pull/138507 for this.
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.ll
AaronBallman wrote:
> Just FYI, the GCC name of the option is `-Wjump-misses-init` (since GCC
> 4.5.0).
Oh good to know, thank you!
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists
pinskia wrote:
Just FYI, the GCC name of the option is -Wjump-misses-init .
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
aeubanks wrote:
this causes a `-Wmicrosoft-goto` warning on
```
$ cat /tmp/a.c
void f() {
goto l;
int i = 0;
l:
}
$ bin/clang-cl /c /tmp/a.c
...
/tmp/a.c(2,2): warning: jump from this goto statement to its label is a
Microsoft extension [-Wmicrosoft-goto]
2 | goto l;
https://github.com/AaronBallman closed
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/AaronBallman updated
https://github.com/llvm/llvm-project/pull/138009
Rate limit ยท GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,s
@@ -6561,18 +6561,28 @@ def ext_goto_into_protected_scope : ExtWarn<
def warn_cxx98_compat_goto_into_protected_scope : Warning<
"jump from this goto statement to its label is incompatible with C++98">,
InGroup, DefaultIgnore;
+def warn_cpp_compat_goto_into_protected_scope :
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wjump-bypasses-init %s
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wc++-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify=good %s
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx,both -x c++ %s
+// good-no-dia
https://github.com/AaronBallman deleted
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wjump-bypasses-init %s
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wc++-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify=good %s
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx,both -x c++ %s
+// good-no-dia
https://github.com/AaronBallman deleted
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wjump-bypasses-init %s
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wc++-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify=good %s
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx,both -x c++ %s
+// good-no-dia
@@ -6561,18 +6561,28 @@ def ext_goto_into_protected_scope : ExtWarn<
def warn_cxx98_compat_goto_into_protected_scope : Warning<
"jump from this goto statement to its label is incompatible with C++98">,
InGroup, DefaultIgnore;
+def warn_cpp_compat_goto_into_protected_scope :
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wjump-bypasses-init %s
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wc++-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify=good %s
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx,both -x c++ %s
+// good-no-dia
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wjump-bypasses-init %s
+// RUN: %clang_cc1 -fsyntax-only -verify=c,both -Wc++-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify=good %s
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx,both -x c++ %s
+// good-no-dia
https://github.com/efriedma-quic approved this pull request.
Please add a test for the new indirect goto diagnostic. Otherwise LGTM
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.
https://github.com/AaronBallman updated
https://github.com/llvm/llvm-project/pull/138009
>From e626293edbba69d0627181b9118aff795bd4173b Mon Sep 17 00:00:00 2001
From: Aaron Ballman
Date: Wed, 30 Apr 2025 14:20:03 -0400
Subject: [PATCH 1/2] [C] Add -Wjump-bypasses-init
We already diagnose when
@@ -560,13 +560,14 @@ LABEL3:{} // #GOTOLBL3
void IndirectGoto3_Loop() {
void* ptr;
#pragma acc parallel loop// #GOTOPAR_LOOP3
- for (unsigned i = 0; i < 5; ++i) {
+ for (unsigned i = 0; i < 5; ++i) { // #INIT
LABEL3:{} // #GOTOLBL3_2
ptr = &&LABEL3;
}
-// expected
@@ -560,13 +560,14 @@ LABEL3:{} // #GOTOLBL3
void IndirectGoto3_Loop() {
void* ptr;
#pragma acc parallel loop// #GOTOPAR_LOOP3
- for (unsigned i = 0; i < 5; ++i) {
+ for (unsigned i = 0; i < 5; ++i) { // #INIT
LABEL3:{} // #GOTOLBL3_2
ptr = &&LABEL3;
}
-// expected
https://github.com/AaronBallman updated
https://github.com/llvm/llvm-project/pull/138009
>From e626293edbba69d0627181b9118aff795bd4173b Mon Sep 17 00:00:00 2001
From: Aaron Ballman
Date: Wed, 30 Apr 2025 14:20:03 -0400
Subject: [PATCH 1/2] [C] Add -Wjump-bypasses-init
We already diagnose when
AaronBallman wrote:
> Frightening how few tests this breaks, but LGTM.
We don't enable `-Wc++-compat` for many of our tests, so the fallout isn't
terrible; just impacts the tests where jump diagnostics were already enabled
for C (which isn't often).
https://github.com/llvm/llvm-project/pull/1
https://github.com/erichkeane approved this pull request.
Frightening how few tests this breaks, but LGTM.
https://github.com/llvm/llvm-project/pull/138009
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/l
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff HEAD~1 HEAD --extensions c,cpp --
clang/test/Sema/warn-jump-bypasses-init.c clang/lib
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Aaron Ballman (AaronBallman)
Changes
We already diagnose when a jump bypasses initialization in C++ because such
code is ill-formed there. However, we were not using this to diagnose those
same jumps in C.
-Wjump-bypasses-init is grouped
https://github.com/AaronBallman created
https://github.com/llvm/llvm-project/pull/138009
We already diagnose when a jump bypasses initialization in C++ because such
code is ill-formed there. However, we were not using this to diagnose those
same jumps in C.
-Wjump-bypasses-init is grouped und
26 matches
Mail list logo