> This patch implements metadirective parsing in the Fortran frontend. This patch (to be applied on top of the current set of metadirective patches) implements a feature that was present in the C and C++ front-ends but not in Fortran - the early culling of metadirective variants that can be eliminated during parsing because their selectors are resolvable at parse-time and still do not match. This is more efficient, and allows code with nested metadirectives like this (which works on other compilers) to compile: !$omp metadirective when (implementation={vendor("ibm")}: & !$omp& target teams distribute) !$omp metadirective when (implementation={vendor("gnu")}: parallel do) This would currently fail because when parsing the body of the 'target teams distribute', the parser sees the metadirective when it is expecting a loop nest. If the vendor("ibm") is eliminated early though, it would just evaluate to '!$omp nothing' and the following metadirective would not be incorrect. This doesn't work for selectors such as 'arch' that would need to be deferred until later passes though. As the selector matching code (omp_context_selector_matches in omp-general.cc) works on Generic trees, I have allowed for a limited translation from the GFortran AST form to tree form during parsing, skipping over things like expression translation that must be done later. I have also fixed another FE issue with nested metadirectives, that occurs when you have something like: program P !$omp metadirective !$omp metadirective !$omp metadirective end program P When gfc_match_end is called after parsing the do statement, it needs to drop down multiple levels from the innermost metadirective state to that of 'program P' in order to find the proper end type, and not just one level as it currently does. Thanks Kwok