diff options
| author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-31 15:59:59 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-31 15:59:59 -0700 |
| commit | 029c7f81a9a445b57a9f6b791a32eebc7b581e2a (patch) | |
| tree | 27627e92ccf3a6c33611f513627003e8468ec135 | |
| parent | 84c7966eed355e9e577b59b974154939c8c6d1bc (diff) | |
| parent | 96138992ac98f8962dc2345d9ba3e99006af80b2 (diff) | |
| download | system_core-029c7f81a9a445b57a9f6b791a32eebc7b581e2a.tar.gz system_core-029c7f81a9a445b57a9f6b791a32eebc7b581e2a.tar.bz2 system_core-029c7f81a9a445b57a9f6b791a32eebc7b581e2a.zip | |
Merge change 9407
* changes:
Fix parsing of function declarations that return pointers.
| -rw-r--r-- | libacc/acc.cpp | 6 | ||||
| -rw-r--r-- | libacc/tests/data/assignmentop.c | 8 | ||||
| -rw-r--r-- | libacc/tests/test.py | 7 |
3 files changed, 10 insertions, 11 deletions
diff --git a/libacc/acc.cpp b/libacc/acc.cpp index f70c7a13..676947e2 100644 --- a/libacc/acc.cpp +++ b/libacc/acc.cpp @@ -4409,15 +4409,11 @@ class Compiler : public ErrorSink { Type* acceptDecl2(Type* pType, tokenid_t& declName, bool nameAllowed, bool nameRequired, bool& reportFailure) { - int ptrCounter = 0; while (accept('*')) { - ptrCounter++; + pType = createType(TY_POINTER, pType, NULL); } pType = acceptDecl3(pType, declName, nameAllowed, nameRequired, reportFailure); - while (ptrCounter-- > 0) { - pType = createType(TY_POINTER, pType, NULL); - } return pType; } diff --git a/libacc/tests/data/assignmentop.c b/libacc/tests/data/assignmentop.c index 10b46376..649edf9b 100644 --- a/libacc/tests/data/assignmentop.c +++ b/libacc/tests/data/assignmentop.c @@ -33,7 +33,6 @@ void testAssignment() { printf("16|= 1 %d\n", a); } -/* Can't use because int* f() is not parsed as a function decl. int a; int* f() { @@ -43,24 +42,21 @@ int* f() { void testEval() { a = 0; - printf("*f() = *f() + 10;"); + printf("*f() = *f() + 10;\n"); *f() = *f() + 10; printf("a = %d\n", a); } void testOpEval() { a = 0; - printf("*f() += 10;"); + printf("*f() += 10;\n"); *f() += 10; printf("a = %d\n", a); } -*/ int main() { testAssignment(); - /* testEval(); testOpEval(); - */ return 0; } diff --git a/libacc/tests/test.py b/libacc/tests/test.py index 4be1f4b7..7bcbdd4d 100644 --- a/libacc/tests/test.py +++ b/libacc/tests/test.py @@ -356,6 +356,13 @@ result: 0""", """2 *= 5 10 17&= 1 1 17^= 1 16 16|= 1 17 +*f() = *f() + 10; +f() +f() +a = 10 +*f() += 10; +f() +a = 10 """) def testcomma(self): |
