summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-5.c
blob: 42a7787f52cd6681a27277141ffc9ea2a2414b6e (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.1 2005/11/28 01:05:08 cloder Exp $ */

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

#include <limits.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(QUAD_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;
}