URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 338 |
// Test operation of -Wparentheses. Warnings for assignments used as
|
// Test operation of -Wparentheses. Warnings for assignments used as
|
// truth-values shouldn't apply other than for plain assignment.
|
// truth-values shouldn't apply other than for plain assignment.
|
// Essentially the same as gcc.dg/Wparentheses-10.c.
|
// Essentially the same as gcc.dg/Wparentheses-10.c.
|
// Origin: Joseph Myers
|
// Origin: Joseph Myers
|
|
|
// { dg-do compile }
|
// { dg-do compile }
|
// { dg-options "-Wparentheses" }
|
// { dg-options "-Wparentheses" }
|
|
|
int foo (int);
|
int foo (int);
|
|
|
int a, b, c;
|
int a, b, c;
|
bool d;
|
bool d;
|
|
|
void
|
void
|
bar (void)
|
bar (void)
|
{
|
{
|
if (a += b)
|
if (a += b)
|
foo (0);
|
foo (0);
|
if (a -= a)
|
if (a -= a)
|
foo (1);
|
foo (1);
|
if (b *= c)
|
if (b *= c)
|
foo (2);
|
foo (2);
|
else
|
else
|
foo (3);
|
foo (3);
|
if (b /= b)
|
if (b /= b)
|
foo (4);
|
foo (4);
|
else
|
else
|
foo (5);
|
foo (5);
|
while (c %= b)
|
while (c %= b)
|
foo (6);
|
foo (6);
|
while (c <<= c)
|
while (c <<= c)
|
foo (7);
|
foo (7);
|
do foo (8); while (a >>= b);
|
do foo (8); while (a >>= b);
|
do foo (9); while (a &= a);
|
do foo (9); while (a &= a);
|
for (;c ^= b;)
|
for (;c ^= b;)
|
foo (10);
|
foo (10);
|
for (;c |= c;)
|
for (;c |= c;)
|
foo (11);
|
foo (11);
|
d = a += b;
|
d = a += b;
|
foo (12);
|
foo (12);
|
d = a -= a;
|
d = a -= a;
|
foo (13);
|
foo (13);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.