<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Book Antiqua",serif;
color:#943634;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>When the source is a C file, the pre-processed file has the extension ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>.i</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’, and when it is a C++ file the pre-processed file has the extension ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>.ii</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’. Perhaps CL files need a 3<sup>rd</sup> convention for naming the pre-processed file, and eventually something similar if the FORTRAN front-end is available? I don’t compile CUDA files, and they may have a similar problem.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Even passing ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>-x cl -c -save-temps</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ does not solve it, so the knowledge that it is an OpenCL source appears to be lost.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> cfe-dev [mailto:cfe-dev-bounces@lists.llvm.org] <b>On Behalf Of </b>mats petersson via cfe-dev<br><b>Sent:</b> 07 November 2016 10:56<br><b>To:</b> Joerg Sonnenberger <joerg@bec.de>; Clang Dev <cfe-dev@lists.llvm.org><br><b>Subject:</b> Re: [cfe-dev] Odd behaviour with '-save-temps' and OpenCL files<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>And how does the parser know from the preprocessed output that it is CL rather than C that it's parsing? I suspect it's the ".cl" part of the name of "<a href="http://filename.cl">filename.cl</a>" that determines that it's CL code in the first place, if that gets replaced with "filename.i", the parser will just say "Ah, it's C-code and has already been preprocessed".<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>Maybe the parser needs a `-x cl` or similar to ensure that the parser knows it's CL-code?<o:p></o:p></p></div><div><p class=MsoNormal>I know that many of the CL parsing things have `if (langOpts.OpenCL) ...` in the parser and various other places. If we have a multi-pass way of running the compiler, it will potentially lose that information when it gets to the next step, is my thinking. I may of course be wrong, and the problem is with something else.<o:p></o:p></p></div><div><p class=MsoNormal><br>--<o:p></o:p></p></div><p class=MsoNormal>Mats<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On 6 November 2016 at 11:04, Joerg Sonnenberger via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal>On Sun, Nov 06, 2016 at 10:01:05AM +0000, mats petersson via cfe-dev wrote:<br>> My guess, and it's only a guess, is that -save-temps causes the compiler to<br>> run each step on those files, by executing independent processes, rather<br>> than the usual "run all steps in parallel" - in my understanding, Clang<br>> doesn't actually work in the "old style cc way" and running several<br>> processes with files produced between each step.<br><br>Yes and no. -svae-temps will run the parser on the preprocessed output,<br>so all macro-expansion knowledge is missing. That changes the impact of<br>a number of warnings like redundant braces. Pragmas are still preserved<br>in the code though. It would be a bug in the OpenCL integration if the<br>pragmas are no longer processed OR if pragmas are silently attached to<br>macros by position.<br><br>Joerg<o:p></o:p></p><div><div><p class=MsoNormal>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>