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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [if-oppr.c] - Diff between revs 298 and 338

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

Rev 298 Rev 338
/* Copyright (C) 2000, 2008 Free Software Foundation, Inc.  */
/* Copyright (C) 2000, 2008 Free Software Foundation, Inc.  */
 
 
/* Test the full range of preprocessor operator precedence.  Each
/* Test the full range of preprocessor operator precedence.  Each
   operator is tested with one of immediately higher precedence to
   operator is tested with one of immediately higher precedence to
   verify it is of strictly lower precedence.  To avoid complications,
   verify it is of strictly lower precedence.  To avoid complications,
   each test uses just those two operators.  Occasionally this assumes
   each test uses just those two operators.  Occasionally this assumes
   correct operation of if-then-else, so the first tests verify this.  */
   correct operation of if-then-else, so the first tests verify this.  */
 
 
/* { dg-do preprocess } */
/* { dg-do preprocess } */
 
 
/* Ensure correct functioning of if-then-else.  */
/* Ensure correct functioning of if-then-else.  */
#if 1
#if 1
#else
#else
#error #else block evaluated for true conditional
#error #else block evaluated for true conditional
#endif
#endif
 
 
#if 0
#if 0
#error #if block evaluated for false conditional
#error #if block evaluated for false conditional
#else
#else
#endif
#endif
 
 
/* : strictly higher than ?.  This would give a syntax error otherwise.  */
/* : strictly higher than ?.  This would give a syntax error otherwise.  */
#if 0 ? 0 : 1 ? 1 : 1
#if 0 ? 0 : 1 ? 1 : 1
#endif
#endif
 
 
/* || strictly higher than ?:. */
/* || strictly higher than ?:. */
#if 1 ? 0: 0 || 1
#if 1 ? 0: 0 || 1
#error operator ?: has higher precedence than operator ||
#error operator ?: has higher precedence than operator ||
#endif
#endif
 
 
/* && strictly higher than ||.  */
/* && strictly higher than ||.  */
#if 1 || 0 && 0
#if 1 || 0 && 0
#else
#else
#error operator || has higher precedence than operator &&
#error operator || has higher precedence than operator &&
#endif
#endif
 
 
/* | strictly higher than &&.  */
/* | strictly higher than &&.  */
#if 0 && 0 | 1
#if 0 && 0 | 1
#error operator && has higher precedence than operator |
#error operator && has higher precedence than operator |
#endif
#endif
 
 
/* ^ strictly higher than |.  */
/* ^ strictly higher than |.  */
#if 1 | 0 ^ 1
#if 1 | 0 ^ 1
#else
#else
#error operator | has higher precedence than operator ^
#error operator | has higher precedence than operator ^
#endif
#endif
 
 
/* & strictly higher than ^.  */
/* & strictly higher than ^.  */
#if 1 ^ 0 & 0
#if 1 ^ 0 & 0
#else
#else
#error operator ^ has higher precedence than operator &
#error operator ^ has higher precedence than operator &
#endif
#endif
 
 
/* == (!=) strictly higher than &.  */
/* == (!=) strictly higher than &.  */
#if 0 & 0 == 0
#if 0 & 0 == 0
#error operator & has higher precedence than operator ==
#error operator & has higher precedence than operator ==
#endif
#endif
 
 
/* < (>, <=, >=) strictly higher than == (!=).  */
/* < (>, <=, >=) strictly higher than == (!=).  */
 
 
#if 0 == 0 < 0
#if 0 == 0 < 0
#else
#else
#error operator == has higher precedence than operator <
#error operator == has higher precedence than operator <
#endif
#endif
 
 
/* << (>>) strictly higher than < (>, <=, >=).  */
/* << (>>) strictly higher than < (>, <=, >=).  */
#if 1 < 1 << 1
#if 1 < 1 << 1
#else
#else
#error operator < has higher precedence than operator <<
#error operator < has higher precedence than operator <<
#endif
#endif
 
 
/* Binary + (-) strictly higher than << (>>).  */
/* Binary + (-) strictly higher than << (>>).  */
#if 0 << 0 + 1
#if 0 << 0 + 1
#error operator << has higher precedence than binary +
#error operator << has higher precedence than binary +
#endif
#endif
 
 
/* Binary * (/, %) strictly higher than binary + (-).  */
/* Binary * (/, %) strictly higher than binary + (-).  */
#if 1 + 0 * 0
#if 1 + 0 * 0
#else
#else
#error binary + has higher precedence than binary *
#error binary + has higher precedence than binary *
#endif
#endif
 
 
/* Unary operators (!, ~, -, +) strictly higher than binary * (/, %).
/* Unary operators (!, ~, -, +) strictly higher than binary * (/, %).
   Equality is hard to detect because of right-associativity.  */
   Equality is hard to detect because of right-associativity.  */
#if ~1 * 0
#if ~1 * 0
#error binary * has higher precedence than operator ~
#error binary * has higher precedence than operator ~
#endif
#endif
 
 
/* () > Unary.  Unfortunately this requires an additional operator.  */
/* () > Unary.  Unfortunately this requires an additional operator.  */
#if -(1 - 1)
#if -(1 - 1)
#error unary - has higher precedence than operator ()
#error unary - has higher precedence than operator ()
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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