[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy created https://github.com/llvm/llvm-project/pull/77586 **Overview:** This pull request fixes #38469 where the issue proposes a new static analysis check in C++ to discourage the explicit return 0; statement at the end of the main() function. As C++ automatically ass

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: Bhuminjay Soni (11happy) Changes **Overview:** This pull request fixes #38469 where the issue proposes a new static analysis check in C++ to discourage the explicit return 0; statement at the end of the main() function. As C++ automa

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77586 >From bae95013cd7f937a5496cafcd40a77cc563addb0 Mon Sep 17 00:00:00 2001 From: 11happy Date: Wed, 10 Jan 2024 16:48:43 +0530 Subject: [PATCH 1/2] Added check for redundant return statement Signed-off-by: 11happy

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread via cfe-commits
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 8f78dd4b92b44c490d263a4d161850853874859d bae95013cd7f937a5496cafcd40a77cc563addb0 --

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,30 @@ +//===--- DonotreturnzerocheckCheck.h - clang-tidy ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,50 @@ +//===--- DonotreturnzerocheckCheck.cpp - clang-tidy ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,50 @@ +//===--- DonotreturnzerocheckCheck.cpp - clang-tidy ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,50 @@ +//===--- DonotreturnzerocheckCheck.cpp - clang-tidy ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. I'm not fan about this check. For me there is no use case for it. For sure it's not readability, simply because explicit return is more readable, and people who do not know that main by default will return 0 may even consider t

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
11happy wrote: > I'm not fan about this check. For me there is no use case for it. For sure > it's not readability, simply because explicit return is more readable, and > people who do not know that main by default will return 0 may even consider > this check a bug, as why all functions got re

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'm not fan about this check. For me there is no use case for it. Yeah, I don't see much motivation for the check. I know that once upon a time (my grey beard is showing, lol) there were compiler bugs in some implementations where a missing return statement in `main` woul

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77586 >From bae95013cd7f937a5496cafcd40a77cc563addb0 Mon Sep 17 00:00:00 2001 From: 11happy Date: Wed, 10 Jan 2024 16:48:43 +0530 Subject: [PATCH 1/5] Added check for redundant return statement Signed-off-by: 11happy

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77586 >From bae95013cd7f937a5496cafcd40a77cc563addb0 Mon Sep 17 00:00:00 2001 From: 11happy Date: Wed, 10 Jan 2024 16:48:43 +0530 Subject: [PATCH 1/6] Added check for redundant return statement Signed-off-by: 11happy

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
11happy wrote: @PiotrZSL I have updated the code as per your suggestions. Can you please take a look at it? Thank you. https://github.com/llvm/llvm-project/pull/77586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: I agree with the opinions from Aaron And Piotr above - this check does the opposite of readability: it forces people to waste time digging into the Standard to find the quote that says the return is not needed. Could some argumentation be provided as to why this would be

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread via cfe-commits
EugeneZelenko wrote: Original issue was closed as `wontfix`. https://github.com/llvm/llvm-project/pull/77586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/77586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: I'm closing this pull request, as both Carlos and Aaron already commented, closed also issue. Please find some other issue to implement, if you got questions, you can always ask in issue, or on discord. This check won't be merged, simply it's as Carols described "nano-optimizat

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
11happy wrote: > I agree with the opinions from Aaron And Piotr above - this check does the > opposite of readability: it forces people to waste time digging into the > Standard to find the quote that says the return is not needed. > > Could some argumentation be provided as to why this would

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread via cfe-commits
EugeneZelenko wrote: @11happy: There are plenty of Clang-tidy issues with such tag: https://github.com/llvm/llvm-project/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aclang-tidy https://github.com/llvm/llvm-project/pull/77586 __

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: There are ~600 other issues, not all were fully "reviewed", and there are many easy ones that aren't mark "good first issue". Once you pick something else, I will be happy to help with the review. https://github.com/llvm/llvm-project/pull/77586 _

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Sure Sure, I will take up another issue. https://github.com/llvm/llvm-project/pull/77586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: Thanks for understanding @11happy ! As you say the learning experience is invaluable and will be very useful for the next check. All contributions are greatly appreciated :) I can recommend you look into fairly recent issues - older issues may not have been reviewed throu