summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-5.c
blob: 6f07c9b606dc003c9e0986982b7e7ca9d9aaefc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*      $OpenBSD: test-5.c,v 1.2 2006/02/14 16:11:45 moritz Exp $ */

/*
 * Placed in the public domain by Chad Loder <cloder@openbsd.org>.
 *
 * Test warning of promotion of function arguments.
 */

#include <stdint.h>

void
foo(unsigned long long a)
{
	a++;
}

void foobar(int a)
{
	a++;
}

void bar(unsigned int a)
{
	a++;
}

/* ARGSUSED */
int
main(int argc, char* argv[])
{
	int a = 0;

	foo(0);		   /* ok, promotion of in-range constant 	  */
	foo(a);		   /* warning: promotion of non-constant 	  */
	foobar(INTMAX_MAX);/* warning: promotion of out-of-range constant */
	bar(-1);	   /* warning: promotion of out-of-range constant */
	bar(0);		   /* ok, promotion of in-range constant 	  */
	return 0;
}