File: e_vargs.c

package info (click to toggle)
mcpp 2.7.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,024 kB
  • ctags: 29,151
  • sloc: ansic: 35,191; sh: 9,231; makefile: 176; cpp: 84; exp: 18
file content (24 lines) | stat: -rw-r--r-- 961 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* e_vargs.c: Error of variable arguments macro */

/* { dg-do preprocess } */
/* { dg-options "-std=c99 -pedantic-errors" } */

/* e_vargs1:    Erroneous usage of __VA_ARGS__  */

/* __VA_ARGS__ should not be defined.   */
    #define __VA_ARGS__ (x, y, z)
/* { dg-error "__VA_ARGS__| shouldn't be defined" "" { target *-*-* } 9 } */

/*
 * __VA_ARGS__ should be the parameter name in replacement list
 * corresponding to '...'.
 */
    #define wrong_macro( a, b, __VA_ARGS__) (a + b - __VA_ARGS__)
/* { dg-error "variadic macro\n\[\^ \]*( error:|) __VA_ARGS__| reserved name `__VA_ARGS__'| Illegal parameter" "" { target *-*-* } 16 } */

/* e_vargs2:    Erroneous macro invocation of variable arguments    */
    /* No argument to correspond __VA_ARGS__    */
    #define debug( ...) fprintf( stderr, __VA_ARGS__)
    debug();
/* { dg-warning "Empty argument" "" { target *-*-* } 22 } */
/* dg-warning, not dg-error to avoid a problem of GCC 4.3 testsuite */