Closed iwill80 closed 9 years ago
final is a C++ keyword: http://en.cppreference.com/w/cpp/language/final Parser/plugin is mainly a C++ parser.
See sonar.cxx.cFilesPatterns for more C compatibility.
Same issue configuring file patterns as follow:
sonar.cxx.cFilesPatterns=.c,.h
Il giorno 30/gen/2015, alle ore 15:44, "Günter Wirth" notifications@github.com ha scritto:
final is a C++ keyword: http://en.cppreference.com/w/cpp/language/final Parser/plugin is mainly a C++ parser.
See sonar.cxx.cFilesPatterns for more C compatibility.
— Reply to this email directly or view it on GitHub.
Feature was added with #291. Looking to the sources keyword final is not supported by the solution.
public static Map<String, String> compatibilityMacros()
Hello, I'm using cxx plugin version 0.9.2 and I found a strange parsing error analyzing. After many attempts I found that the error was caused by an argument called "final". For example, if you have a C function declared as follow:
int foo(int final);
it will produce the following error:
14:12:03.079 ERROR - Unable to parse file: xxx com.sonar.sslr.api.RecognitionException: Parse error at line 715 column 8 failed to match all of: templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName operatorFunctionId literalOperatorId operatorFunctionId conversionFunctionId literalOperatorId ptrDeclarator templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName operatorFunctionId literalOperatorId operatorFunctionId conversionFunctionId literalOperatorId declarator functionDefinition templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName operatorFunctionId literalOperatorId operatorFunctionId conversionFunctionId literalOperatorId ptrDeclarator templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName templateName templateName enumName typedefName originalNamespaceName namespaceAlias decltypeSpecifier templateName operatorFunctionId literalOperatorId operatorFunctionId conversionFunctionId literalOperatorId declarator initDeclarator initDeclaratorList ... 714: --> int foo(int final); 716: ... Failed at rules: /-templateName /-simpleTemplateId | /-templateName | /-simpleTemplateId +-className +-enumName +-typedefName /-typeName | /-originalNamespaceName | +-namespaceAlias +-namespaceName +-decltypeSpecifier /-nestedNameSpecifier /-ptrOperator | /-templateName | /-simpleTemplateId | | /-templateName | | /-simpleTemplateId | +-className | +-enumName | +-typedefName | /-typeName | | /-originalNamespaceName | | +-namespaceAlias | +-namespaceName | +-decltypeSpecifier | /-nestedNameSpecifier | | /-templateName | | /-simpleTemplateId | +-className | | /-templateName | | /-simpleTemplateId | | | /-templateName | | | /-simpleTemplateId | | +-className | | +-enumName | | +-typedefName | | /-typeName | | | /-originalNamespaceName | | | +-namespaceAlias | | +-namespaceName | | +-decltypeSpecifier | | /-nestedNameSpecifier | | /-qualifiedId | | | /-templateName | | | /-simpleTemplateId | | | +-operatorFunctionId | | | +-literalOperatorId | | | /-templateId | | | +-operatorFunctionId | | | +-conversionFunctionId | | | +-literalOperatorId | | +-unqualifiedId | +-idExpression | /-declaratorId +-noptrDeclarator /-ptrDeclarator /-noptrDeclarator consumed from (715, 7) to (715, 8): ( /-ptrDeclarator +-ptrDeclarator consumed from (715, 7) to (715, 8): ( | /-templateName | /-simpleTemplateId | | /-templateName | | /-simpleTemplateId | +-className | +-enumName | +-typedefName | /-typeName | | /-originalNamespaceName | | +-namespaceAlias | +-namespaceName | +-decltypeSpecifier | /-nestedNameSpecifier | /-ptrOperator | | /-templateName | | /-simpleTemplateId | | | /-templateName | | | /-simpleTemplateId | | +-className | | +-enumName | | +-typedefName | | /-typeName | | | /-originalNamespaceName | | | +-namespaceAlias | | +-namespaceName | | +-decltypeSpecifier | | /-nestedNameSpecifier | | | /-templateName | | | /-simpleTemplateId | | +-className | | | /-templateName | | | /-simpleTemplateId | | | | /-templateName | | | | /-simpleTemplateId | | | +-className | | | +-enumName | | | +-typedefName | | | /-typeName | | | | /-originalNamespaceName | | | | +-namespaceAlias | | | +-namespaceName | | | +-decltypeSpecifier | | | /-nestedNameSpecifier | | | /-qualifiedId | | | | /-templateName | | | | /-simpleTemplateId | | | | +-operatorFunctionId | | | | +-literalOperatorId | | | | /-templateId | | | | +-operatorFunctionId | | | | +-conversionFunctionId | | | | +-literalOperatorId | | | +-unqualifiedId | | +-idExpression | | /-declaratorId | +-noptrDeclarator | /-ptrDeclarator +-noptrDeclarator consumed from (715, 7) to (715, 8): ( /-declarator +-declarator consumed from (715, 7) to (715, 8): ( /-functionDefinition consumed from (715, 0) to (715, 7): int foo +-functionDefinition consumed from (715, 0) to (715, 8): int foo ( | /-templateName | /-simpleTemplateId | | /-templateName | | /-simpleTemplateId | +-className | +-enumName | +-typedefName | /-typeName | | /-originalNamespaceName | | +-namespaceAlias | +-namespaceName | +-decltypeSpecifier | /-nestedNameSpecifier | /-ptrOperator | | /-templateName | | /-simpleTemplateId | | | /-templateName | | | /-simpleTemplateId | | +-className | | +-enumName | | +-typedefName | | /-typeName | | | /-originalNamespaceName | | | +-namespaceAlias | | +-namespaceName | | +-decltypeSpecifier | | /-nestedNameSpecifier | | | /-templateName | | | /-simpleTemplateId | | +-className | | | /-templateName | | | /-simpleTemplateId | | | | /-templateName | | | | /-simpleTemplateId | | | +-className | | | +-enumName | | | +-typedefName | | | /-typeName | | | | /-originalNamespaceName | | | | +-namespaceAlias | | | +-namespaceName | | | +-decltypeSpecifier | | | /-nestedNameSpecifier | | | /-qualifiedId | | | | /-templateName | | | | /-simpleTemplateId | | | | +-operatorFunctionId | | | | +-literalOperatorId | | | | /-templateId | | | | +-operatorFunctionId | | | | +-conversionFunctionId | | | | +-literalOperatorId | | | +-unqualifiedId | | +-idExpression | | /-declaratorId | +-noptrDeclarator | /-ptrDeclarator | /-noptrDeclarator consumed from (715, 7) to (715, 8): ( | /-ptrDeclarator | +-ptrDeclarator consumed from (715, 7) to (715, 8): ( | | /-templateName | | /-simpleTemplateId | | | /-templateName | | | /-simpleTemplateId | | +-className | | +-enumName | | +-typedefName | | /-typeName | | | /-originalNamespaceName | | | +-namespaceAlias | | +-namespaceName | | +-decltypeSpecifier | | /-nestedNameSpecifier | | /-ptrOperator | | | /-templateName | | | /-simpleTemplateId | | | | /-templateName | | | | /-simpleTemplateId | | | +-className | | | +-enumName | | | +-typedefName | | | /-typeName | | | | /-originalNamespaceName | | | | +-namespaceAlias | | | +-namespaceName | | | +-decltypeSpecifier | | | /-nestedNameSpecifier | | | | /-templateName | | | | /-simpleTemplateId | | | +-className | | | | /-templateName | | | | /-simpleTemplateId | | | | | /-templateName | | | | | /-simpleTemplateId | | | | +-className | | | | +-enumName | | | | +-typedefName | | | | /-typeName | | | | | /-originalNamespaceName | | | | | +-namespaceAlias | | | | +-namespaceName | | | | +-decltypeSpecifier | | | | /-nestedNameSpecifier | | | | /-qualifiedId | | | | | /-templateName | | | | | /-simpleTemplateId | | | | | +-operatorFunctionId | | | | | +-literalOperatorId | | | | | /-templateId | | | | | +-operatorFunctionId | | | | | +-conversionFunctionId | | | | | +-literalOperatorId | | | | +-unqualifiedId | | | +-idExpression | | | /-declaratorId | | +-noptrDeclarator | | /-ptrDeclarator | +-noptrDeclarator consumed from (715, 7) to (715, 8): ( | /-declarator | +-declarator consumed from (715, 7) to (715, 8): ( | /-initDeclarator | +-initDeclarator consumed from (715, 7) to (715, 8): ( | /-initDeclaratorList | +-initDeclaratorList consumed from (715, 7) to (715, 8): ( | /-simpleDeclaration consumed from (715, 0) to (715, 7): int foo +-blockDeclaration /-declaration declarationSeq consumed from (115, 0) to (713, 19): ... , hpn_timestamp_t * f , const char flag ) ; linkageSpecification consumed from (108, 3) to (108, 15): extern \"C\" { declaration translationUnit
If you just rename the argument into _final no error will be find.