[BACK]Return to msg_259_ilp32.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tests / usr.bin / xlint / lint1

File: [cvs.NetBSD.org] / src / tests / usr.bin / xlint / lint1 / msg_259_ilp32.c (download)

Revision 1.4, Tue Aug 31 19:26:23 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.3: +6 -1 lines

tests/lint: add cross-references to message 297

The check for lossy integer conversions is already implemented, it's
just not activated in the default NetBSD build.

/*	$NetBSD: msg_259_ilp32.c,v 1.4 2021/08/31 19:26:23 rillig Exp $	*/
# 3 "msg_259_ilp32.c"

// Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]

/*
 * See also msg_297, but that requires the flags -a -p -P, which are not
 * enabled in the default NetBSD build.
 */

/* lint1-only-if: ilp32 */
/* lint1-extra-flags: -h */

void farg_char(char);
void farg_int(int);
void farg_long(long);

void
example(char c, int i, long l)
{
	farg_char(c);
	farg_int(c);
	/* expect+1: from 'char' to 'long' due to prototype [259] */
	farg_long(c);

	farg_char(i);		/* XXX: why no warning? */
	farg_int(i);
	/* expect+1: from 'int' to 'long' due to prototype [259] */
	farg_long(i);

	farg_char(l);		/* XXX: why no warning? */
	/* expect+1: from 'long' to 'int' due to prototype [259] */
	farg_int(l);
	farg_long(l);
}