File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -60,9 +60,9 @@ void UnintendedCharOstreamOutputCheck::check(
6060 const auto *Call = Result.Nodes .getNodeAs <CXXOperatorCallExpr>(" x" );
6161 const Expr *Value = Call->getArg (1 );
6262 diag (Call->getOperatorLoc (),
63- " ( %0 passed to 'operator<<' outputs as character instead of integer. "
63+ " %0 passed to 'operator<<' outputs as character instead of integer. "
6464 " cast to 'unsigned' to print numeric value or cast to 'char' to print "
65- " as character) " )
65+ " as character" )
6666 << Value->getType () << Value->getSourceRange ();
6767}
6868
Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ It could be fixed as
2121
2222.. code-block :: c++
2323
24- std::cout << ( uint32_t)v ;
24+ std::cout << static_cast< uint32_t>(v) ;
2525
2626Or cast to char to explicitly indicate the intent
2727
2828.. code-block :: c++
2929
30- std::cout << ( char)v ;
30+ std::cout << static_cast< char>(v) ;
Original file line number Diff line number Diff line change @@ -30,12 +30,12 @@ class A : public std::ostream {};
3030void origin_ostream (std::ostream &os) {
3131 unsigned char unsigned_value = 9 ;
3232 os << unsigned_value;
33- // CHECK-MESSAGES: [[@LINE-1]]:6: warning: ( 'unsigned char' passed to
33+ // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'unsigned char' passed to
3434 // 'operator<<' outputs as character instead of integer
3535
3636 signed char signed_value = 9 ;
3737 os << signed_value;
38- // CHECK-MESSAGES: [[@LINE-1]]:6: warning: ( 'signed char' passed to
38+ // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'signed char' passed to
3939 // 'operator<<' outputs as character instead of integer
4040
4141 char char_value = 9 ;
@@ -45,12 +45,12 @@ void origin_ostream(std::ostream &os) {
4545void based_on_ostream (A &os) {
4646 unsigned char unsigned_value = 9 ;
4747 os << unsigned_value;
48- // CHECK-MESSAGES: [[@LINE-1]]:6: warning: ( 'unsigned char' passed to
48+ // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'unsigned char' passed to
4949 // 'operator<<' outputs as character instead of integer
5050
5151 signed char signed_value = 9 ;
5252 os << signed_value;
53- // CHECK-MESSAGES: [[@LINE-1]]:6: warning: ( 'signed char' passed to
53+ // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'signed char' passed to
5454 // 'operator<<' outputs as character instead of integer
5555
5656 char char_value = 9 ;
You can’t perform that action at this time.
0 commit comments