@@ -103,15 +103,15 @@ func testNil() {
103103}
104104
105105func testBitwiseOps( ) {
106- _ = DISPATCH_TIME_FOREVER as CUnsignedLongLong
106+ _ = DISPATCH_TIME_FOREVER as CUnsignedLongLong // expected-warning {{redundant cast to 'CUnsignedLongLong' (aka 'UInt64') has no effect}} {{29-50=}}
107107 _ = ( BIT_SHIFT_1 | BIT_SHIFT_2) as CInt
108- _ = BIT_SHIFT_3 as CLongLong
109- _ = BIT_SHIFT_4 as CUnsignedInt
108+ _ = BIT_SHIFT_3 as CLongLong // expected-warning {{redundant cast to 'CLongLong' (aka 'Int64') has no effect}} {{19-32=}}
109+ _ = BIT_SHIFT_4 as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{19-35=}}
110110
111- _ = RSHIFT_ONE as CUnsignedInt
111+ _ = RSHIFT_ONE as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{18-34=}}
112112 _ = RSHIFT_INVALID // expected-error {{use of unresolved identifier 'RSHIFT_INVALID'}}
113113
114- _ = XOR_HIGH as CUnsignedLongLong
114+ _ = XOR_HIGH as CUnsignedLongLong // expected-warning {{redundant cast to 'CUnsignedLongLong' (aka 'UInt64') has no effect}} {{16-37=}}
115115
116116 var attributes = 0 as CInt
117117 attributes |= ATTR_BOLD
@@ -121,30 +121,30 @@ func testBitwiseOps() {
121121}
122122
123123func testIntegerArithmetic( ) {
124- _ = ADD_ZERO as CInt
125- _ = ADD_ONE as CInt
126- _ = ADD_TWO as CInt
127- _ = ADD_MINUS_TWO as CInt
128- _ = ADD_MIXED_WIDTH as CLongLong
129- _ = ADD_MIXED_SIGN as CLongLong
130- _ = ADD_UNDERFLOW as CUnsignedInt
131- _ = ADD_OVERFLOW as CUnsignedInt
132-
133- _ = SUB_ONE as CInt
134- _ = SUB_ZERO as CInt
135- _ = SUB_MINUS_ONE as CInt
136- _ = SUB_MIXED_WIDTH as CLongLong
137- _ = SUB_MIXED_SIGN as CUnsignedInt
138- _ = SUB_UNDERFLOW as CUnsignedInt
139- _ = SUB_OVERFLOW as CUnsignedInt
140-
141- _ = MULT_POS as CInt
142- _ = MULT_NEG as CInt
143- _ = MULT_MIXED_TYPES as CLongLong
144-
145- _ = DIVIDE_INTEGRAL as CInt
146- _ = DIVIDE_NONINTEGRAL as CInt
147- _ = DIVIDE_MIXED_TYPES as CLongLong
124+ _ = ADD_ZERO as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{16-24=}}
125+ _ = ADD_ONE as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{15-23=}}
126+ _ = ADD_TWO as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{15-23=}}
127+ _ = ADD_MINUS_TWO as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{21-29=}}
128+ _ = ADD_MIXED_WIDTH as CLongLong // expected-warning {{redundant cast to 'CLongLong' (aka 'Int64') has no effect}} {{23-36=}}
129+ _ = ADD_MIXED_SIGN as CLongLong // expected-warning {{redundant cast to 'CLongLong' (aka 'Int64') has no effect}} {{22-35=}}
130+ _ = ADD_UNDERFLOW as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{21-37=}}
131+ _ = ADD_OVERFLOW as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{20-36=}}
132+
133+ _ = SUB_ONE as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{15-23=}}
134+ _ = SUB_ZERO as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{16-24=}}
135+ _ = SUB_MINUS_ONE as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{21-29=}}
136+ _ = SUB_MIXED_WIDTH as CLongLong // expected-warning {{redundant cast to 'CLongLong' (aka 'Int64') has no effect}} {{23-36=}}
137+ _ = SUB_MIXED_SIGN as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{22-38=}}
138+ _ = SUB_UNDERFLOW as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{21-37=}}
139+ _ = SUB_OVERFLOW as CUnsignedInt // expected-warning {{redundant cast to 'CUnsignedInt' (aka 'UInt32') has no effect}} {{20-36=}}
140+
141+ _ = MULT_POS as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{16-24=}}
142+ _ = MULT_NEG as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{16-24=}}
143+ _ = MULT_MIXED_TYPES as CLongLong // expected-warning {{redundant cast to 'CLongLong' (aka 'Int64') has no effect}} {{24-37=}}
144+
145+ _ = DIVIDE_INTEGRAL as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{23-31=}}
146+ _ = DIVIDE_NONINTEGRAL as CInt // expected-warning {{redundant cast to 'CInt' (aka 'Int32') has no effect}} {{26-34=}}
147+ _ = DIVIDE_MIXED_TYPES as CLongLong // expected-warning {{redundant cast to 'CLongLong' (aka 'Int64') has no effect}} {{26-39=}}
148148 _ = DIVIDE_INVALID // expected-error {{use of unresolved identifier 'DIVIDE_INVALID'}}
149149}
150150
0 commit comments