<div dir="ltr">Thanks for the reports Timo!<br><br><div class="gmail_quote">On Sat, Oct 18, 2008 at 1:05 PM, Timo Sirainen <span dir="ltr"><<a href="mailto:tss@iki.fi">tss@iki.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I tried compiling Dovecot using clang. The blocker problem was that<br>
va_arg() isn't implemented. Other than that there are a few other small<br>
issues:</blockquote><div><br></div><div>va_arg of structures, I presume? va_arg should sort of work for other things. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
1. automake's dependency tracking doesn't work with ccc for some reason.<br>
It always recompiles everything. I didn't bother trying to figure out<br>
why.</blockquote><div><br></div><div>I'm not sure what "automake's dependency tracking" translates to. clang/ccc doesn't support -MM and friends yet, <a href="http://llvm.org/PR2618">http://llvm.org/PR2618</a>, which could very well be the problem.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
<br>
2. Some small differences with ccc/clang and gcc cause warnings and<br>
compiler errors:<br>
<br>
// gcc thinks these types are compatible, clang doesn't<br>
struct foo {<br>
        int x;<br>
};<br>
<br>
int main(void) {<br>
        const struct foo *src;<br>
<br>
        if (!__builtin_types_compatible_p(struct foo, typeof(*src)))<br>
                printf("error\n");<br>
        return 0;<br>
}</blockquote><div><br></div><div>Filed for discussion here: <a href="http://llvm.org/PR2919">http://llvm.org/PR2919</a></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
// noreturn attribute is useful also for function pointers, but<br>
// clang gives a warning<br>
static void (*fatal)(void) __attribute__((noreturn));<br>
<br>
static void __attribute__((noreturn))<br>
die(void)<br>
{<br>
        fatal();<br>
}<br>
<br>
int main(void) {<br>
        fatal();<br>
        return 0;<br>
}</blockquote><div><br></div><div>Fixed here: <a href="http://llvm.org/viewvc/llvm-project?view=rev&revision=57778">http://llvm.org/viewvc/llvm-project?view=rev&revision=57778</a>, confirmation appreciated.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
// clang gives a warning, gcc doesn't. I guess gcc figures out that<br>
// a format argument is going in so it should also be coming out.<br>
// That's how I also prefer it (unless there's another way to<br>
// prevent the warning?)<br>
static const char * __attribute__((format_arg(1)))<br>
printf_format_fix(const char *format)<br>
{<br>
        // maybe modify format<br>
        return format;<br>
}<br>
<br>
int main(void) {<br>
        printf(printf_format_fix("%s"), "hello");<br>
        return 0;<br>
}</blockquote><div><br></div><div>Honestly I'm not sure what is going on here. Note that by default clang applies more stringent default warnings than (my) gcc, however I do see gcc as not warning on this code. Feel free to file a bug on this, but I'm not really sure what the desired behavior is.</div>
<div><br></div><div> - Daniel</div><div><br></div></div></div>