OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [vararg1.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do run } */
2
/* { dg-options -w } */
3
 
4
/* count() used to give 1 owing to a buggy test for varargs.  */
5
#define count(y...)  count1 ( , ##y)
6
#define count1(y...) count2 (y,1,0)
7
#define count2(_,x0,n,y...) n
8
#if count() != 0 || count(A) != 1
9
#error Incorrect vararg argument counts
10
#endif
11
 
12
/* Test for changed behavior of the GNU varargs extension.
13
   ##args, where args is a rest argument which received zero tokens,
14
   used to delete the previous sequence of nonwhitespace characters.
15
   Now it deletes the previous token.  */
16
 
17
#include <string.h>
18
 
19
#define S(str, args...) "  " str "\n", ##args
20
 
21
int
22
main()
23
{
24
  const char *s = S("foo");
25
  return strchr (s, '\n') == NULL;
26
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.