// _MYMACRO_ myType foo(); // _MYMACRO_ myType foo() {} // extern void foo2() _MYMACRO_; public void testUndefinedMacrosInFunctionDeclarations_Bug234085() throws Exception { final String comment = getAboveComment(); for (ParserLanguage lang : ParserLanguage.values()) { IASTTranslationUnit tu = parse(comment, lang, false, false); IASTProblemDeclaration pd = getDeclaration(tu, 0); assertEquals("_MYMACRO_", pd.getRawSignature()); IASTSimpleDeclaration sdecl = getDeclaration(tu, 1); assertEquals("myType foo();", sdecl.getRawSignature()); pd = getDeclaration(tu, 2); assertEquals("_MYMACRO_", pd.getRawSignature()); IASTFunctionDefinition fdef = getDeclaration(tu, 3); assertEquals("myType foo() {}", fdef.getRawSignature()); sdecl = getDeclaration(tu, 4); assertEquals("extern void foo2()", sdecl.getRawSignature()); pd = getDeclaration(tu, 5); // the missing semicolon if (lang == ParserLanguage.CPP) { pd = getDeclaration(tu, 6); assertEquals("_MYMACRO_;", pd.getRawSignature()); } else { sdecl = getDeclaration(tu, 6); assertEquals("_MYMACRO_;", sdecl.getRawSignature()); } } }
// class A { // enum _T { I J, K }; // missing comma // int i; // }; public void testEnumError_Bug72685() throws Exception { final String comment = getAboveComment(); IASTTranslationUnit tu = parse(comment, ParserLanguage.CPP, false, false); IASTCompositeTypeSpecifier ct = getCompositeType(tu, 0); IASTSimpleDeclaration e = getDeclaration(ct, 0); IASTProblemDeclaration p = getDeclaration(ct, 1); assertEquals("J, K };", p.getRawSignature()); IASTSimpleDeclaration s = getDeclaration(ct, 2); assertEquals("int i;", s.getRawSignature()); }
// enum _T { I J, K }; // missing comma // int i; public void testEnumProblem() throws Exception { final String comment = getAboveComment(); for (ParserLanguage lang : ParserLanguage.values()) { IASTTranslationUnit tu = parse(comment, lang, false, false); IASTSimpleDeclaration e = getDeclaration(tu, 0); IASTProblemDeclaration p = getDeclaration(tu, 1); assertEquals("J, K };", p.getRawSignature()); IASTSimpleDeclaration s = getDeclaration(tu, 2); assertEquals("int i;", s.getRawSignature()); } }