[PATCH] Try one approach to compile a class as one compilation unit

Noel Power nopower at suse.com
Mon Apr 15 02:21:32 PDT 2013


On 13/04/13 15:20, Tor Lillqvist (via Code Review) wrote:
> Hi,
>
> I have submitted a patch for review:
>
>      https://gerrit.libreoffice.org/3373
>
> To pull it, you can do:
>
>      git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/73/3373/1
>
> Try one approach to compile a class as one compilation unit
>
> In many cases the sources for some class have been split up into several
> source files, typically suffixed with a number 0, 1, 2 etc. Presumably this
> has been done because some compiler years ago was not capable of compiling all
> the source for that class at one time, or some other no longer relevant
> reason.
>
> It would be nice to get rid of this convention, so that clever compilers have
> a better chance of noticing unused private fields in a class, for instance. On
> the other hand, just combining the source files in question into one source
> file and removing the old source files from git leads to a discontinuity in
> version control history.
I don't believe that this split was done ( in this case ) to get around 
compiler limitations or whatnot.
It seems in this case that the split here is a logical one ( to 
distinguish between p-code operations that take
zero, one or two ( 0,1,2 :-) ) parameters. If you look in the source 
code at the SbiRuntime::StepXXX
methods you will see what I mean.
Still though, splitting the class source across different source files 
is not intuitive ( certainly I remember being
confused with this particular example when I first came across it ) I 
suppose perhaps a different class design
( or separation with helper classes or whatever ) would achieve the same 
goal.
Even though I have gotten used to the twisted reality that is 
Libreoffice source code organisation....
> Maybe a good compromise would be to introduce one new
> source file what would include the existing numbered source files? Or, as in
> this case, include the others into one already appropriately named source
> file?
sounds like that is probably the best solution to preserve the history, 
otoh it kinda sticks in the throat
not to prune these anachronisms

Noel


More information about the LibreOffice mailing list