From 9a4147846545648e84c9a33257d4d996a6e9d327 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Fri, 6 Feb 2009 14:38:51 +0000 Subject: [PATCH] No default arguments in plain c, bug 263803. --- .../org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java | 2 +- .../cdt/internal/core/dom/parser/c/GNUCSourceParser.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 5ff51636126..d13b7b906ce 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -137,7 +137,7 @@ public class AST2Tests extends AST2BaseTest { } public void testBug75340() throws Exception { - IASTTranslationUnit tu = parseAndCheckBindings("void f(int i = 0, int * p = 0);"); //$NON-NLS-1$ + IASTTranslationUnit tu = parseAndCheckBindings("void f(int i = 0, int * p = 0);", ParserLanguage.CPP); //$NON-NLS-1$ IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0]; assertEquals(ASTSignatureUtil.getParameterSignature(sd.getDeclarators()[0]), "(int, int *)"); //$NON-NLS-1$ } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java index f0d8dc8bbcd..736266308f6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java @@ -1775,7 +1775,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { try { fPreventKnrCheck++; declSpec= declSpecifierSeq(option); - declarator = initDeclarator(option); + declarator = declarator(option); } catch(FoundDeclaratorException fd) { declSpec= fd.declSpec; declarator= fd.declarator; @@ -1783,9 +1783,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { altDeclarator= fd.altDeclarator; backup(fd.currToken); } catch (FoundAggregateInitializer lie) { - if (declSpec == null) - declSpec= lie.fDeclSpec; - declarator= addInitializer(lie); + declSpec= lie.fDeclSpec; + declarator= lie.fDeclarator; } finally { fPreventKnrCheck--; }