1 /* $NetBSD: lex_integer_ilp32.c,v 1.7 2023/02/19 11:50:29 rillig Exp $ */ 2 # 3 "lex_integer_ilp32.c" 3 4 /* 5 * Tests for lexical analysis of integer constants. 6 * 7 * C99 6.4.4.1 "Integer constants" 8 */ 9 10 /* lint1-only-if: ilp32 */ 11 12 void sinki(int); 13 void sinku(unsigned int); 14 15 /* All platforms supported by lint have 32-bit int in two's complement. */ 16 void 17 test_signed_int(void) 18 { 19 sinki(0); 20 21 sinki(-1); 22 23 sinki(2147483647); 24 25 /* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */ 26 sinki(2147483648); 27 28 sinki(-2147483647); 29 30 /* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */ 31 sinki(-2147483648); 32 } 33 34 void 35 test_unsigned_int(void) 36 { 37 sinku(0); 38 39 sinku(2147483647); 40 sinku(2147483648); 41 42 sinku(2147483648U); 43 sinku(4294967295U); 44 45 /* expect+1: warning: integer constant out of range [252] */ 46 sinku(4294967296U); 47 } 48