On Mon, Jan 12, 2015 at 05:32:14PM +0100, Thomas Schwinge wrote: > I have now committed the patch to gomp-4_0-branch in the following form. > The issues raised above remain to be resolved. > > In spirit against the tree.h header flattening, I had to keep the > #include "include/gomp-constants.h" in gcc/tree-core.h, because otherwise > I'd have to add it to a ton of *.c files, just for the enum gomp_map_kind > definition. > > I found that in the C++ dialect used by GCC, it is not possible to > declare an enum without giving the list of enumerators. N2764 (from > 2008) resolved this by adding appropriate syntax for declaring enums, > however: "warning: scoped enums only available with -std=c++11 or > -std=gnu++11". If it were possible to use this, we could add to > gcc/tree-core.h: > > enum gomp_map_kind : char; > > ... (or similar), and this way decouple the declaration (gcc/tree-core.h) > From the actual "population of it" (include/gomp-constants.h). > Alternatively, in gcc/tree-core.h:struct tree_omp_clause, we could switch > the map_kind member from enum gomp_map_kind to a char -- but that would > defeat the usage of an enum (easy pretty-printing of its enumerators in > GDB, and so on.).
Or just don't do this and duplicate the constants and just assert somewhere (in omp-low.c) at compile time that all the values match. Either using char and casting the value only in the OMP_* macros or duplicating the values sound preferrable over including include/gomp-constants.h from tree-core.h. Jakub