Skip to content

Use standard fixed-width typenames for cast checks #282

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

Merged
merged 6 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "Add fixed-width c-style cast test case"
This reverts commit f944faa.
  • Loading branch information
nate-thirdwave committed Aug 23, 2024
commit 1cc9305c62c1e971bd21d59deeda6370ba88db84
5 changes: 2 additions & 3 deletions samples/silly-sample/filters.def
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
Done processing src/sillycode.cpp
Category 'build' errors found: 1
Category 'legal' errors found: 1
Category 'readability' errors found: 5
Category 'readability' errors found: 4
Category 'runtime' errors found: 12
Total errors found: 19
Total errors found: 18

src/sillycode.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
src/sillycode.cpp:3: Found C system header after C++ system header. Should be: sillycode.h, c system, c++ system, other. [build/include_order] [4]
Expand All @@ -26,5 +26,4 @@ src/sillycode.cpp:208: Static/global string variables are not permitted. [runt
src/sillycode.cpp:227: Static/global string variables are not permitted. [runtime/string] [4]
src/sillycode.cpp:228: Using C-style cast. Use reinterpret_cast<double*>(...) instead [readability/casting] [4]
src/sillycode.cpp:243: Using C-style cast. Use reinterpret_cast<derived2*>(...) instead [readability/casting] [4]
src/sillycode.cpp:266: Using C-style cast. Use static_cast<int64_t>(...) instead [readability/casting] [4]

3 changes: 1 addition & 2 deletions samples/silly-sample/includeorder_cfirst.def
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
1
3
Done processing src/sillycode.cpp
Total errors found: 111
Total errors found: 110

src/sillycode.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
src/sillycode.cpp:8: public: should be indented +1 space inside class Date [whitespace/indent] [3]
Expand Down Expand Up @@ -109,7 +109,6 @@ src/sillycode.cpp:257: Tab found; better to use spaces [whitespace/tab] [1]
src/sillycode.cpp:257: At least two spaces is best between code and comments [whitespace/comments] [2]
src/sillycode.cpp:260: Empty loop bodies should use {} or continue [whitespace/empty_loop_body] [5]
src/sillycode.cpp:260: At least two spaces is best between code and comments [whitespace/comments] [2]
src/sillycode.cpp:266: Using C-style cast. Use static_cast<int64_t>(...) instead [readability/casting] [4]
src/sillycode.cpp:126: Add #include <utility> for swap [build/include_what_you_use] [4]
src/sillycode.cpp:168: Add #include <memory> for unique_ptr<> [build/include_what_you_use] [4]
src/sillycode.cpp:224: Add #include <limits> for numeric_limits<> [build/include_what_you_use] [4]
Expand Down
1 change: 0 additions & 1 deletion samples/silly-sample/sed.def
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ sed -i '208s/\([^ ]\){/\1 {/' src/sillycode.cpp # Missing space before { [white
# src/sillycode.cpp:257: "At least two spaces is best between code and comments" [whitespace/comments] [2]
# src/sillycode.cpp:260: "Empty loop bodies should use {} or continue" [whitespace/empty_loop_body] [5]
# src/sillycode.cpp:260: "At least two spaces is best between code and comments" [whitespace/comments] [2]
# src/sillycode.cpp:266: "Using C-style cast. Use static_cast<int64_t>(...) instead" [readability/casting] [4]
# src/sillycode.cpp:126: "Add #include <utility> for swap" [build/include_what_you_use] [4]
# src/sillycode.cpp:168: "Add #include <memory> for unique_ptr<>" [build/include_what_you_use] [4]
# src/sillycode.cpp:224: "Add #include <limits> for numeric_limits<>" [build/include_what_you_use] [4]
Expand Down
3 changes: 1 addition & 2 deletions samples/silly-sample/simple.def
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ src/*.cpp
1
3
Done processing src/sillycode.cpp
Total errors found: 112
Total errors found: 111

src/sillycode.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
src/sillycode.cpp:3: Found C system header after C++ system header. Should be: sillycode.h, c system, c++ system, other. [build/include_order] [4]
Expand Down Expand Up @@ -110,7 +110,6 @@ src/sillycode.cpp:257: Tab found; better to use spaces [whitespace/tab] [1]
src/sillycode.cpp:257: At least two spaces is best between code and comments [whitespace/comments] [2]
src/sillycode.cpp:260: Empty loop bodies should use {} or continue [whitespace/empty_loop_body] [5]
src/sillycode.cpp:260: At least two spaces is best between code and comments [whitespace/comments] [2]
src/sillycode.cpp:266: Using C-style cast. Use static_cast<int64_t>(...) instead [readability/casting] [4]
src/sillycode.cpp:126: Add #include <utility> for swap [build/include_what_you_use] [4]
src/sillycode.cpp:168: Add #include <memory> for unique_ptr<> [build/include_what_you_use] [4]
src/sillycode.cpp:224: Add #include <limits> for numeric_limits<> [build/include_what_you_use] [4]
Expand Down
5 changes: 0 additions & 5 deletions samples/silly-sample/src/sillycode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,3 @@ int i;
for (i = 0; i < max; ++i); // bug waiting to happen
if (i == j)
return i;

void cast_check() {
int16_t a = 0;
uint64_t b = (int64_t)a;
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy