While trying to track down some bugs in the metadirective patches (currently on the OG13 branch), I found that I was getting totally lost in the undocumented data structures for context selectors; the multiple levels of TREE_PURPOSE and TREE_VALUE that don't hint at what kind of object is being accessed, generic variable names like "t1" and "t2" likewise. Similarly the inconsistent and undocumented representation of different properties, switch statements over the first character of the trait selector set name, etc added to my confusion. It's not surprising that adding new features made this foundation pretty creaky and I think that adding the additional selector features in OMP 5.2 and 6.* is going to cause it to fall over completely.
This series of patches adds a layer of data abstraction, using at least slightly more descriptive names, and then tries to address some of the representation and coding issues. Part 1 introduces some macros (e.g., OMP_TSS_ID instead of TREE_PURPOSE to get the name of a selector) and renames a bunch of variables (e.g., tss for a trait-set selector, ts for a trait selector, tp for a trait property). Those changes were relatively mechanical. I also added some abstraction for the trait-score so that it need not be handled explicitly when processing property lists. Part 2 changes the representation of name-list properties so that both the string and identifier forms store the name in the same place. Part 3 is a more radical change: it replaces the string names of trait-set and trait selectors with enumerators, which allows clean-up of those funky switch statements. I also made things more table-driven. Alas, this part is still WIP; there's an ICE in one of the test cases I haven't been able to track down yet. I can continue to work on this patch set in the next couple of weeks if the general direction is seen as a good thing. I believe there is a little more latitude re the end of stage 1 with OpenMP (as there is with target-specific patches) since it is not enabled by default; in any case I'd like to get feedback on the general direction before continuing too much farther with this, and adapting the metadirective patches to match it. -Sandra Sandra Loosemore (3): OpenMP: Introduce accessor macros and constructors for context selectors. OpenMP: Unify representation of name-list properties. OpenMP: Use enumerators for names of trait-sets and traits gcc/c/c-parser.cc | 212 ++++------- gcc/cp/decl.cc | 8 +- gcc/cp/parser.cc | 212 ++++------- gcc/cp/pt.cc | 93 +++-- gcc/fortran/trans-openmp.cc | 65 +++- gcc/gimplify.cc | 4 +- gcc/omp-general.cc | 713 ++++++++++++++++++++++-------------- gcc/omp-general.h | 132 ++++++- 8 files changed, 811 insertions(+), 628 deletions(-) -- 2.31.1