OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [defined.c] - Diff between revs 149 and 154

Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
/* Copyright (C) 2000 Free Software Foundation, Inc.  */
/* Copyright (C) 2000 Free Software Foundation, Inc.  */
 
 
/* { dg-do preprocess } */
/* { dg-do preprocess } */
 
 
/* Tests behavior of the defined operator.  */
/* Tests behavior of the defined operator.  */
 
 
/*  Source: Neil Booth, 29 Oct 2000, Zack Weinberg 11 Dec 2000.  */
/*  Source: Neil Booth, 29 Oct 2000, Zack Weinberg 11 Dec 2000.  */
 
 
#define defined                 /* { dg-error "defined" } */
#define defined                 /* { dg-error "defined" } */
 
 
/* No diagnostics, though you could argue there should be.  */
/* No diagnostics, though you could argue there should be.  */
#if defined defined
#if defined defined
#error defined is defined!
#error defined is defined!
#endif
#endif
 
 
#define is_Z_defined defined Z
#define is_Z_defined defined Z
 
 
#if defined Z
#if defined Z
#error Z is not defined
#error Z is not defined
#endif
#endif
 
 
/* The behavior of "defined" when it comes from a macro expansion is
/* The behavior of "defined" when it comes from a macro expansion is
   now documented.  */
   now documented.  */
#if is_Z_defined
#if is_Z_defined
#error Macro expanding into defined operator test 1
#error Macro expanding into defined operator test 1
#endif
#endif
 
 
#define Z
#define Z
 
 
#if !defined Z
#if !defined Z
#error Z is defined
#error Z is defined
#endif
#endif
 
 
#if !is_Z_defined
#if !is_Z_defined
#error Macro expanding into defined operator test 2
#error Macro expanding into defined operator test 2
#endif
#endif
 
 
#undef is_Z_defined
#undef is_Z_defined
#undef Z
#undef Z
 
 
/* Do all the tests over again with the () form of defined.  */
/* Do all the tests over again with the () form of defined.  */
 
 
/* No diagnostics, though you could argue there should be.  */
/* No diagnostics, though you could argue there should be.  */
#if defined(defined)
#if defined(defined)
#error defined is defined!
#error defined is defined!
#endif
#endif
 
 
#define is_Z_defined defined ( Z )
#define is_Z_defined defined ( Z )
 
 
#if defined(Z)
#if defined(Z)
#error Z is not defined
#error Z is not defined
#endif
#endif
 
 
/* The behavior of "defined" when it comes from a macro expansion is
/* The behavior of "defined" when it comes from a macro expansion is
   now documented.  */
   now documented.  */
#if is_Z_defined
#if is_Z_defined
#error Macro expanding into defined operator test 1
#error Macro expanding into defined operator test 1
#endif
#endif
 
 
#define Z
#define Z
 
 
#if !defined(Z)
#if !defined(Z)
#error Z is defined
#error Z is defined
#endif
#endif
 
 
#if !is_Z_defined
#if !is_Z_defined
#error Macro expanding into defined operator test 2
#error Macro expanding into defined operator test 2
#endif
#endif
 
 
/* Use of defined in different contexts.  */
/* Use of defined in different contexts.  */
 
 
#define bad1 defined
#define bad1 defined
#if !bad1 Z                     /* { dg-warning "may not be portable" } */
#if !bad1 Z                     /* { dg-warning "may not be portable" } */
#error Z is defined
#error Z is defined
#endif 
#endif 
 
 
#if !bad1 (Z)                   /* { dg-warning "may not be portable" } */
#if !bad1 (Z)                   /* { dg-warning "may not be portable" } */
#error Z is defined
#error Z is defined
#endif 
#endif 
 
 
#define bad2 defined (Z
#define bad2 defined (Z
#if !bad2)                      /* { dg-warning "may not be portable" } */
#if !bad2)                      /* { dg-warning "may not be portable" } */
#error Z is defined
#error Z is defined
#endif 
#endif 
 
 
 
 

powered by: WebSVN 2.1.0

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