[cfe-dev] improving modularize
Douglas Gregor
dgregor at apple.com
Thu Mar 7 15:55:31 PST 2013
On Feb 26, 2013, at 1:20 PM, "Thompson, John" <John_Thompson at playstation.sony.com> wrote:
> Hi,
>
> For those working on modules (such as Doug) as well as those using or just interested in the modules effort underway, do you have some specific ideas for improving modularize?
>
> I guess the main issue to do with coverage, that is, making sure that real or potential problems are detected and reported. Related to that would be to improve the existing error messages and warnings, in order to help the user pinpoint and fix the problem areas.
>
> Recently I used modularize to help prepare some of the headers (mostly C, with some C++) from one of our platforms for modules, and that has given me a couple of ideas for places to start. These are mainly just general directions, and will need some digging into to figure what or if anything can be done:
>
> 1. I’m wondering if the messages like: ‘note: 'sigvec' at 378:8 not always provided” could be more helpful in providing the file name, and perhaps even the associated conditional directives that fire differently. Also, report it once.
Yes, that would be super-useful.
> 2. For the messages like: “’xxx’ defined at both ‘yyy’ and ‘zzz’”, combine them into a single message for all instances.
Sure!
>
> 3. Catch “extern “C”” problems. I had some problems where some “#include” directives were buried in some “extern “C” { }” blocks in some files and not in others. See if this could be detected. It’s generally a bad practice, irrespective of modules, isn’t it?
I definitely consider it bad practice, and it would be great to catch such problems.
> Please pass along any ideas you have, as I’m taking a crack at working on adding some improvements to modularize.
>
> On a related topic, I tried to write a little test case for #3 like this:
>
> without_extern_c.h:
>
> void my_func(int a);
>
> with_extern_c.h:
>
> extern "C" {
> void my_func(int a);
> }
>
> extern_test.h:
>
> #include "with_extern_c.h"
> #include "without_extern_c.h"
>
> void test3()
> {
> my_func(1);
> }
>
> modularize input 1:
>
> extern_test_c.h
>
> modularize input 2:
>
> without_extern_c.h
> with_extern_c.h
>
> This is a problem because of the different linkages, right? It wasn’t detected in modularize, perhaps because it’s a C++ thing.
modularize doesn't look at language linkage, but it certainly should to detect this sort of problem.
- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130307/8e6ae72a/attachment.html>
More information about the cfe-dev
mailing list