xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_305.c (revision cc3c7d5b6a6d896c4703f47bb421c40c9600a9b0)
1 /*	$NetBSD: msg_305.c,v 1.6 2024/01/07 21:19:42 rillig Exp $	*/
2 # 3 "msg_305.c"
3 
4 /* Test for message: conversion of %s to %s requires a cast, op %s [305] */
5 
6 /* lint1-flags: -sw -X 351 */
7 
8 void *void_pointer;
9 void (*void_function)(void);
10 int (*int_function)(int);
11 
12 void
example(int cond)13 example(int cond)
14 {
15 	/* expect+1: warning: conversion of function pointer to 'void *' requires a cast, op = [305] */
16 	void_pointer = void_function;
17 
18 	/* expect+1: warning: conversion of 'void *' to function pointer requires a cast, op = [305] */
19 	void_function = void_pointer;
20 
21 	/* expect+1: warning: conversion of function pointer to 'void *' requires a cast, op = [305] */
22 	void_pointer = cond ? void_function : int_function;
23 	/* expect+1: warning: conversion of function pointer to 'void *' requires a cast, op : [305] */
24 	void_pointer = cond ? void_pointer : int_function;
25 	/* expect+1: warning: conversion of function pointer to 'void *' requires a cast, op : [305] */
26 	void_pointer = cond ? void_function : void_pointer;
27 }
28