1 /* { dg-do run } */
2 
3 #define __GNU_ALWAYS_INLINE inline __attribute__(( __always_inline__))
4 
5 #define DEVT_ALL    0
6 
7 #define CMD_ABI_DEVICES 100
8 
9 static __GNU_ALWAYS_INLINE int
send_msg_to_gm_w_dev_t(int msg_type,unsigned int dev_msg_type,int devt,...)10 send_msg_to_gm_w_dev_t(int msg_type, unsigned int dev_msg_type,
11 		       int devt, ...)
12 {
13   char s[256];
14   int nArgs = __builtin_va_arg_pack_len();
15   if (nArgs != 2)
16     __builtin_abort ();
17   __builtin_sprintf (s, "%d", __builtin_va_arg_pack ());
18   if (__builtin_strcmp (s, "99") != 0)
19     __builtin_abort ();
20   /* do something with nArgs and ... */
21   return 0;
22 }
23 
24 static __GNU_ALWAYS_INLINE int
send_msg_to_gm(int msg_type,unsigned int dev_msg_type,...)25 send_msg_to_gm(int msg_type, unsigned int dev_msg_type,
26 	       ...)
27 {
28   int nArgs = __builtin_va_arg_pack_len();
29   if (nArgs != 2)
30     __builtin_abort ();
31   return send_msg_to_gm_w_dev_t(msg_type, dev_msg_type,
32 				DEVT_ALL, __builtin_va_arg_pack());
33 }
34 
35 static __GNU_ALWAYS_INLINE int
send_enable(unsigned int dev_msg_type,...)36 send_enable(unsigned int dev_msg_type, ...)
37 {
38   int nArgs = __builtin_va_arg_pack_len();
39   if (nArgs != 2)
40     __builtin_abort ();
41   return send_msg_to_gm(CMD_ABI_DEVICES, dev_msg_type,  __builtin_va_arg_pack());
42 }
43 
44 int
main(void)45 main(void)
46 {
47   int mode = 99;
48 
49   send_enable(1, mode, sizeof(mode));
50 
51   return 0;
52 }
53