Mentions légales du service

Skip to content

Attr improve parse2

LAWALL Julia requested to merge attr_improve_parse2 into master

This is a bit more of the series with the following log:

These parsing errors were discovered by running a build of Coccinelle's master branch on gitlab to parse the source code of Linux v5.5-rc4 and Linux v5.6-rc7. Coccinelle currently manages attributes similar to comments, so to explicity state what the attributes are to the C parser, a MACROANNOTATION hint was used in Coccinelle's standard.h file. The hint enables the parser to correctly identify attributes, and thus potentially handle them differently in the AST.

Upon collection of these parsing errors, The GNU C Compiler's grammar was taken as a reference for introducing attributes in correct places in Coccinelle's C parser.

Upon applying the MACROANNOTATION hint to a majority of the attributes in Coccinelle's standard.h file and parsing the source code of Linux v5.6-rc7, the difference between the stats (of --parse-c) before and after applying this patch series are as follows:

Before:

    NB total files = 28268; perfect = 25697; pbs = 2570; timeout = 0;

=========> 90% nb good = 19160664, nb passed = 135235 =========> 0.70% passed nb good = 19160664, nb bad = 129685 =========> 99.33% good or passed

After:

    NB total files = 28268; perfect = 25699; pbs = 2568; timeout = 0;

=========> 90% nb good = 19160856, nb passed = 71716 =========> 0.37% passed nb good = 19160856, nb bad = 129493 =========> 99.33% good or passed

Fixes for a few test case failures that arise from applying the new productions are also included. The test cases that failed were:

    unstruct
    nocast

What this patch series does not do:

  • Add attributes from all the new productions into the C AST. Some of these are dropped.
  • Reflect changes from the C parser in the SmPL parser.

Separate patches will be sent for the above.

Changes in v2:

parsing_c: parser: Add attribute production in spec_qualif_list

  • This patch applied on its own causes a build error. Fix the error by removing the let binding for abstract_declaratort in the type_name rule

parsing_c: parser: Make abstract_declarator pass attributes

  • Reflect changes from the above build error fix.

Merge request reports