Home | History | Annotate | Line # | Download | only in lint1
msg_118.c revision 1.7
      1  1.7  rillig /*	$NetBSD: msg_118.c,v 1.7 2023/07/07 19:45:22 rillig Exp $	*/
      2  1.1  rillig # 3 "msg_118.c"
      3  1.1  rillig 
      4  1.4  rillig /* Test for message: semantics of '%s' change in ANSI C; use explicit cast [118] */
      5  1.1  rillig 
      6  1.7  rillig /* lint1-flags: -hw -X 351 */
      7  1.3  rillig 
      8  1.3  rillig int
      9  1.5  rillig int_shl_uint(int left, unsigned int right)
     10  1.3  rillig {
     11  1.5  rillig 	return left << right;
     12  1.3  rillig }
     13  1.3  rillig 
     14  1.5  rillig int
     15  1.5  rillig int_shr_uint(int left, unsigned int right)
     16  1.5  rillig {
     17  1.6  rillig 	/* expect+1: warning: semantics of '>>' change in ANSI C; use explicit cast [118] */
     18  1.5  rillig 	return left >> right;
     19  1.5  rillig }
     20  1.5  rillig 
     21  1.5  rillig int
     22  1.5  rillig int_shl_int(int left, int right)
     23  1.3  rillig {
     24  1.5  rillig 	return left << right;
     25  1.3  rillig }
     26  1.5  rillig 
     27  1.5  rillig /*
     28  1.5  rillig  * The behavior of typeok_shl can only be triggered on 64-bit platforms, or
     29  1.5  rillig  * in C99 mode, and the above tests require C90 mode.
     30  1.5  rillig  *
     31  1.5  rillig  * On 32-bit platforms both operands of the '<<' operator are first promoted
     32  1.5  rillig  * individually, and since C90 does not know 'long long', the maximum
     33  1.5  rillig  * bit-size for an integer type is 32 bits.
     34  1.5  rillig  *
     35  1.5  rillig  * Because of this difference there is no test for that case since as of
     36  1.5  rillig  * 2021-05-04, all lint1 tests must be independent of the target platform and
     37  1.5  rillig  * there is no way to toggle individual tests depending on the properties of
     38  1.5  rillig  * the target platform.
     39  1.5  rillig  */
     40