<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Oct 14, 2013, at 11:48 AM, Thompson, John <<a href="mailto:John_Thompson@playstation.sony.com">John_Thompson@playstation.sony.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Hi,<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">I’m trying to set up modules for some platform headers that are found in 3 separate subdirectories:<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">(platform)/target/include<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">(platform)/target/include_common<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">(platform)/host_tools/lib/clang/include<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Unfortunately various headers include headers from other directories and visa/versa, such that having a module.map in each of these directories fails to build, giving me an errors such as:<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">(file): fatal error: cyclic dependency in module 'platform_include': platform _include -> platform _host_tools -> platform _include<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Is there a way to address this without fixing the circular dependencies?<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><br></div></div></div></blockquote><div><br></div>You've found it: collect the cyclic includes into a single module.</div><div><br><blockquote type="cite" dir="auto"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">One way that seems to work is to put it all in one module map, at the (platform) level, with relative paths in the header directives. It appears the compiler will walk up the directories until it finds the module.map file, right?</div></div></div></blockquote><div><br></div><div>Yes, that's correct.</div><div><br></div><br><blockquote type="cite" dir="auto"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Regarding the #include to module mechanism, can I assume the compiler matches the module even if the path given in the #include doesn’t match the path in the “header” directives in the module.map file, but does refer to the same absolute file? I.e. the #include references “stdio.h”, and a “-I(platform)/target/include” option is given to the compiler, but the (platform)/module.map “header” directive references “target/include/stdio.h”.</div></div></div></blockquote><div><br></div>The module map infrastructure matches files via their file system identity (e.g., the inode on *nix systems); it doesn't matter how you spell the path to find that file.<br><br><blockquote type="cite" dir="auto"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">I have a test bed that includes over 400 stub files that just #include one header, and a makefile to build them. As a rough performance test, with or without the –fmodules option, they all compile okay in a clean make, but the –fmodules version is about 15% slower (in a run after the modules are compiled). (Note that I have the compiler output using –emit-llvm because I’m coercing it to think it’s a ps4 compiler, since our version doesn’t have modules support yet, and the .o output seems to be broken for x86_64.) I heard others got better performance, but I don’t know how it’s measured. Any thoughts?</div></div></div></blockquote><br></div><div>I don't really know what you're measuring. Modules tends to be a win when there is a lot of code in your headers (as tends to happen in C++ and Objective-C, for example), because the cost of parsing said headers is significantly greater than loading the corresponding top-level module. If you're just benchmarking module import vs. including fairly small headers, it won't be a win.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div><div><br></div></body></html>