https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52846

--- Comment #8 from Salvatore Filippone <sfilippone at uniroma2 dot it> ---
(In reply to Paul Thomas from comment #7)
> Created attachment 35926 [details]
> A partially cooked patch to complete the implentation of submodules
> 
> The attached is a first attempt to complete the submodule implementation
> such that private entities are correctly dealt with.
> 
> There are two parts to the patch:
> 
> (i) Modifications to the front end to write a second half to the module
> files, which contains all the information about the private entities in the
> module. This is the bulk of the patch; and
> 
> (ii) A change in the way that declarations of private entities are handled
> in trans-decl.c. This follows a suggestion from Richard Biener to use a
> technique borrowed from g++. In this patch it is only applied to variables.
> ............
> Cheers
> 
> Paul

Seems to work for my codes.

I am not completely happy with the fact that a change in the PRIVATE entities
will cause a change of the .mod file; it may be argued that changes are more
likely to occur in the submodules than in the main module, but still, this is
not 100% satisfactory wrt the advertisement that submodules are ssolving the
compilation cascade problem. 
>From a user's point of view, I do not see a good solution to this; if the .mod
file contains any kind of timestamp, it's going to change anyway, even in the
case where the PRIVATE part is written to a separate file. 

On a relate note, the point raised in the mailing list about protecting trade
secrets by putting them in the PRIVATE parts is IMHO moot: if I really wanted
to protect trade secrets, I would put them in a separate module that is only
ever USEd by the implementation files of the user visible module, files of
which I only distribute the object code. 
I don't think that C++ is any different in this respect. 

Salvatore

Reply via email to