Every header is self-contained and includes only what it must to
function, relying on users include what they need in source files,
adopting a pay-what-you-use model (in particular for internal
dependencies).
In order to reduce parsing load on clients, the generated ParserKeywords
now come in their own sorted-by-first-letter files, so that inclusion of
the entire tree is unnecessary when only a handful of keywords will do.
This also applies to the generated source code (which is pretty heavy to
compile), which now is split into multiple files to enable parallel
builds.
With this commit the generation of built in keywords is completely
changed. The most important changes include:
1) We have autogenerated a class for each keyword in the new
ParserKeywords { ... } namespace.
2) The autogenerated classes derive from ParserKeyword, and the
default constructor will build of a fully initialized
ParserKeyword instance, i.e. the keyword used to parse the EQUIL
keyword can be instantiated as simple as:
ParserKeywords::EQUIL kw;
3) The generated keywords have built in static constants for keyword
and item names, and item default values. That way it should be
possible for the compiler to catch trivial errors like trying to
access the keyword "PoRO"; also the the access to default values
means that properties can be initialized without actually
insantiating a DeckKeyword.
4) Two new classes Generator/KeywordLoader and
Generator/KeywordGenerator have been created, with the help of
these classes the keyword generation code is significantly
simplified.
this is just the result of
```
find -iname "*.[ch]pp" | xargs sed -i "s/ *$//"
find opm/parser/share/keywords -type f | xargs sed -i "s/ *$//"
```
so if it causes conflicts with other patches, the others should get
priority. The rationale behind this patch is that some people tell
their editor to remove white space which leads to larger than
necessary patches...
the problem was the ALL keyword which caused a naming conflict with
Opm::ParserItemSizeEnum::ALL. I haven't considered the possibility to
break the build by adding a keyword, so sorry for the breakage.
On a more philosophical ground I think it is a bit questionable to
auto-generate test cases at build time because they will automatically
match the keyword definition, whether this definition makes sense or
not...
It seems like some optimization passes of CLang which are enabled by
-O2 (at least in my version, 3.3) do not like nested scopes and long
functions too much. Thus, slightly change the generated source. Timing
on my (quite beefy) machine:
without patch:
make
rm -rf generated-source; time make
time make
[...]
real 10m31.110s
user 10m16.264s
sys 0m13.672s
with patch:
make
rm -rf generated-source; time make
time make
[...]
real 0m47.011s
user 0m44.670s
sys 0m1.968s
the memory used by the compiler goes from 28.8GB to about 330 MB. (I
suppose not everybody has 32 Gigs of memory yet. ;)