<html>
<head>
<meta content="text/html; charset=KOI8-R" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 08.02.2012 23:47, David Blaikie wrote:
<blockquote
cite="mid:CAENS6EsOGADDiPdiFJ5bY03D9nY0M323Krisdrec1=zmAVVJSg@mail.gmail.com"
type="cite">
<pre wrap="">On Wed, Feb 8, 2012 at 11:25 AM, Chris Lattner <a class="moz-txt-link-rfc2396E" href="mailto:clattner@apple.com"><clattner@apple.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
On Feb 8, 2012, at 5:31 AM, Vasiliy Korchagin wrote:
</pre>
<blockquote type="cite">
<pre wrap="">07.02.2012 07:27, Eli Friedman ÐÉÛÅÔ:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, Feb 6, 2012 at 6:51 PM, Xin Tong<a class="moz-txt-link-rfc2396E" href="mailto:xerox.time.tech@gmail.com"><xerox.time.tech@gmail.com></a> šwrote:
</pre>
<blockquote type="cite">
<pre wrap="">Is there any way to stop this ?
/home/socrates/llvm/llvm-3.0.src/benchmarks/powerstone/crc/crc.c:67:1:
error: 'main' must return 'int'
void main()
^
1 error generated.
</pre>
</blockquote>
<pre wrap="">You mean besides fixing the source of your benchmark so it's valid C?
Not at the moment... patches welcome.
-Eli
</pre>
</blockquote>
<pre wrap="">We suggest patch for allowing main() function to have non-integer return type. This feature can be enabled with "-allow-non-int-main" option. In this case warning about incorrect main() return type will be printed instead of error.
In patch also included test case for this feature.
Vasiliy Korchagin,
</pre>
</blockquote>
<pre wrap="">
Hi Vasiliy,
Please send clang patches to cfe-dev.
</pre>
</blockquote>
<pre wrap="">
or even cfe-commits (further instructions are here:
<a class="moz-txt-link-freetext" href="http://clang.llvm.org/get_involved.html">http://clang.llvm.org/get_involved.html</a>)
[I've dropped llvm-dev and added cfe-commits to this email]
My first thought based on your description alone would be that we
should support this, if at all, probably in the way that GCC already
does - surfacing non-int returning main as a warning in C (under
-Wmain) and error in C++ (as it is already) if that's practical.
& looking at the patch itself: Your change is even more permissive
than GCC (when you use the flag you've added) allowing C++ to have
void returning main. I don't see any need to be so accepting.
(& the change you've made in Sema::ActOnFinishFunctionBody scares me a
bit - what does that do when you have int returning main but you turn
this flag on? not allow implicit return 0? that seems problematic)
- David
</pre>
</blockquote>
<meta http-equiv="content-type" content="text/html; charset=KOI8-R">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); ">David, thanks for your reply.
Seems like my response missed mailing list, so I'm sending it again.
I changed the patch and now "-allow-non-int-main" option allows to print
a warning in C and error in C++ in case of non-integer main. I also
fixed implicit returning 0.
Vasiliy Korchagin,
<meta http-equiv="content-type" content="text/html; charset=KOI8-R">The Institute for System Programming of the Russian Academy of Sciences<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); "></pre>
</pre>
</body>
</html>