<br><br><div class="gmail_quote">On Fri, Jun 15, 2012 at 1:18 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On Jun 13, 2012, at 4:30 PM, Michael Spencer wrote:<br>
<br>
> On Wed, Jun 13, 2012 at 2:38 PM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
>> On Mon, Jun 4, 2012 at 2:29 PM, david.cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
>>><br>
>>> I'm one of the CMake developers. We have an issue in our bug tracker<br>
>>> that's<br>
>>> related to clang's command line argument parsing:<br>
>>> <a href="http://public.kitware.com/Bug/view.php?id=13194" target="_blank">http://public.kitware.com/Bug/view.php?id=13194</a><br>
>>><br>
>>> The bug reported is using this version of clang (MacOS X 10.7.3 with Xcode<br>
>>> 4.3.2):<br>
>>> $ /usr/bin/cc -v<br>
>>> Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)<br>
>>><br>
>>> In the bug report, the CMake script code is trying to run clang to test if<br>
>>> it recognizes a given command line argument. We expect to report that it<br>
>>> does not support an argument if there's an error when using the argument<br>
>>> trying to compile this snippet: "int main() { return 0;}"<br>
>>><br>
>>> When given "-maltivec" it produces:<br>
>>> clang: warning: argument unused during compilation: '-maltivec'<br>
>>><br>
>>> By giving us that output, clang indicates that it does recognize the -m<br>
>>> compiler argument, but warns us that -maltivec has not been used. (At<br>
>>> least,<br>
>>> that's how I read it.)<br>
>>><br>
>>> So, here's the question: Can you recommend how to robustly detect whether<br>
>>> or<br>
>>> not clang supports a given command line argument? For both existing<br>
>>> versions<br>
>>> of clang in the wild, and future releases.<br>
>>><br>
>>> The bug reporter in this case, wants us to recognize "argument unused<br>
>>> during<br>
>>> compilation" as an error, but I'm concerned that doing so will falsely<br>
>>> report other valid command line arguments as unavailable...<br>
>>><br>
>>><br>
>>> Thanks,<br>
>>> David Cole<br>
>>> Kitware, Inc.<br>
>>><br>
>>><br>
>>> --<br>
>>> View this message in context:<br>
>>> <a href="http://clang-developers.42468.n3.nabble.com/Question-how-to-robustly-detect-available-command-line-arguments-tp4024269.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Question-how-to-robustly-detect-available-command-line-arguments-tp4024269.html</a><br>

>>> Sent from the Clang Developers mailing list archive at Nabble.com.<br>
>>> _______________________________________________<br>
>>> cfe-dev mailing list<br>
>>> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
>><br>
>><br>
>><br>
>> Not a lot of response on this one, so let me re-phrase:<br>
>><br>
>><br>
>> How can I tell what the output "clang: warning: argument unused during<br>
>> compilation" means?<br>
>><br>
>> If I get it when using "-maltivec" does it mean that ANY -m argument would<br>
>> be unused?<br>
>><br>
>><br>
>> Or, what's the best way of knowing the set of valid possible values for -m?<br>
>><br>
>><br>
>> Thanks,<br>
>> David Cole<br>
>> Kitware, Inc.<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
>><br>
><br>
> "warning: argument unused during compilation" means that the argument<br>
> did not effect the compilation at all. Removing it would not change<br>
> the output. It does not mean that all -m arguments would be unused. If<br>
> the code depends on the gcc behavior of this flag, then it is possible<br>
> that clang would not preserve that behavior. From my quick reading it<br>
> seems that -maltivec just allows the compiler to generate altivec<br>
> code, which clang allows if the target supports it.<br>
><br>
> I agree with the reporter that this warning should indicate that clang<br>
> does not support the specific option given.<br>
<br>
<br>
</div></div>I think what we're missing is that "argument unused during compilation" means either "I don't know what this argument is" or "I know what this argument is, and it has no impact". It would be preferable if the driver distinguished these cases: <a href="http://llvm.org/bugs/show_bug.cgi?id=13119" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=13119</a><br>

<br>
        -Doug<br>
</blockquote></div><br><div><br></div><div>Thanks for the replies -- I'm still not sure what we should do in our CMake module, but this gives us better input for thinking about the problem. For now, we'll leave it as is until we come up with an approach (if we can) that will work with existing and future clang.</div>
<div><br></div><div>David</div><div><br></div>