File: n_24_3_run.c.gcc2

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 (33 lines) | stat: -rw-r--r-- 891 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
25
26
27
28
29
30
31
32
33
/* n_24_3_run.c:    # operator in macro definition. */

#include    <string.h>
#include    <stdlib.h>
#include    <assert.h>

#define str( a)     # a

int main( void)
{
/* 24.3:    \ is inserted before \ and " in or surrounding literals and no
        other character is inserted to anywhere.    */
    assert( strcmp( str( '"' + "' \""), "'\"' + \"' \\\"\"") == 0);

/* 24.4:    Line splicing by <backslash><newline> is done prior to token
        parsing.   */
    assert( strcmp( str( "ab\
c"), "\"abc\"") == 0);

    return  0;
}

/* { dg-do run }
 * { dg-options "-ansi -w" }
 */

/*
 * Note: DejaGnu cannot handle the preprocessor output which contains a
 *  doubly stringized string literal.
 *  So, we test this testcase with strcmp().
 * Note: -no-integrated-cpp is necessary for MCPP on GCC 3.  GCC 2, however,
 *  does not recognize this option.  Remove this option on GCC 2.
 */