File: u_1_19.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 (35 lines) | stat: -rw-r--r-- 1,333 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
34
35
/* u_1_19.c:    Undefined behaviors on undefined #define and #undef syntax. */

/* { dg-do preprocess } */

/* u.1.19:  A macro expanded to "defined" in #if expression.    */
#define DEFINED     defined
#if     DEFINED DEFINED     /* { dg-warning "this use of \"defined\" may not be portable| is expanded to \"defined\"" } */
#endif

#undef  __linux__
#undef  __arm__
#define __linux__   1
#define HAVE_MREMAP defined(__linux__) && !defined(__arm__)
/* Wrong macro definition.
 * This macro should be defined as follows.
 *  #if defined(__linux__) && !defined(__arm__)
 *  #define HAVE_MREMAP 1
 *  #endif
 */
#if HAVE_MREMAP /* { dg-warning "this use of \"defined\" may not be portable| is expanded to \"defined\"" } */
    mremap();
#endif

/* u.1.20:  Undefining __FILE__, __LINE__, __DATE__, __TIME__, __STDC__ or
        "defined" in #undef directive.  */
#undef  __LINE__    /* { dg-error "undefining| shouldn't be undefined" } */

/* u.1.21:  Defining __FILE__, __LINE__, __DATE__, __TIME__, __STDC__ or
        "defined" in #define directive. */
#define __LINE__    1234    /* { dg-error "defining| shouldn't be redefined" } */
#define defined     defined /* { dg-error "cannot be used as a macro name| invalid macro name | shouldn't be defined" } */
#if     defined defined
#   error   I am not a good preprocessor.
#endif