mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Fix and testcase for 191450, __attribute__ in-between pointer-operators.
This commit is contained in:
parent
c6851a2543
commit
c5c666a8b6
5 changed files with 26 additions and 23 deletions
|
@ -5482,9 +5482,6 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertFalse(binding instanceof IProblemBinding);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// #define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
|
||||
// #define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY(default) {
|
||||
// _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -3924,4 +3924,13 @@ public class AST2Tests extends AST2BaseTest {
|
|||
parse( content, ParserLanguage.CPP);
|
||||
parse( content, ParserLanguage.C);
|
||||
}
|
||||
|
||||
// void ( __attribute__((__stdcall__))* foo1) (int);
|
||||
// void ( * __attribute__((__stdcall__)) foo2) (int);
|
||||
// void ( * __attribute__((__stdcall__))* foo3) (int);
|
||||
public void testBug191450_attributesInBetweenPointers() throws Exception {
|
||||
StringBuffer buffer = getContents(1)[0];
|
||||
parse( buffer.toString(), ParserLanguage.CPP, true, true );
|
||||
parse( buffer.toString(), ParserLanguage.C, true, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -2206,11 +2206,10 @@ public class CompleteParser2Tests extends BaseTestCase {
|
|||
writer.write( "int func3 (void) __attribute__((id,id (3)));\n" ); //$NON-NLS-1$
|
||||
writer.write( "int func4 (void) __attribute__((id,id (1+2)));\n" ); //$NON-NLS-1$
|
||||
writer.write( "void (****f1)(void) __attribute__((noreturn));\n" ); //$NON-NLS-1$
|
||||
/* not yet supported by the GCC compiler:
|
||||
* writer.write( "void (__attribute__((noreturn)) ****f2) (void);\n" ); //$NON-NLS-1$
|
||||
* writer.write( "char *__attribute__((aligned(8))) *f3;\n" ); //$NON-NLS-1$
|
||||
* writer.write( "char * __attribute__((aligned(8))) * f3;\n" ); //$NON-NLS-1$
|
||||
*/ writer.write( "void fatal1 () __attribute__ ((noreturn));\n" ); //$NON-NLS-1$
|
||||
writer.write( "void (__attribute__((noreturn)) ****f2) (void);\n" ); //$NON-NLS-1$
|
||||
writer.write( "char *__attribute__((aligned(8))) *f3;\n" ); //$NON-NLS-1$
|
||||
writer.write( "char * __attribute__((aligned(8))) * f3;\n" ); //$NON-NLS-1$
|
||||
writer.write( "void fatal1 () __attribute__ ((noreturn));\n" ); //$NON-NLS-1$
|
||||
writer.write( "int square1 (int) __attribute__ ((pure));\n" ); //$NON-NLS-1$
|
||||
writer.write( "extern int\n" ); //$NON-NLS-1$
|
||||
writer.write( "my_printf1 (void *my_object, const char *my_format, ...)\n" ); //$NON-NLS-1$
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Ed Swartz (Nokia)
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Ed Swartz (Nokia)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -1342,10 +1342,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
protected void consumePointerOperators(List pointerOps)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
for (;;) {
|
||||
// having __attribute__ inbetween pointers is not yet supported by the GCC compiler
|
||||
// if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after a *
|
||||
// __attribute__();
|
||||
|
||||
// __attribute__ in-between pointers
|
||||
__attribute_decl_seq(supportAttributeSpecifiers, false);
|
||||
|
||||
IToken mark = mark();
|
||||
IToken last = null;
|
||||
|
||||
|
|
|
@ -542,9 +542,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
throws EndOfFileException, BacktrackException {
|
||||
|
||||
for (;;) {
|
||||
// having __attribute__ inbetween pointers is not yet supported by the GCC compiler
|
||||
// if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after a *
|
||||
// __attribute__();
|
||||
// __attribute__ in-between pointers
|
||||
__attribute_decl_seq(supportAttributeSpecifiers, false);
|
||||
|
||||
if (LT(1) == IToken.tAMPER) {
|
||||
int length = LA(1).getEndOffset() - LA(1).getOffset();
|
||||
|
|
Loading…
Add table
Reference in a new issue