<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-tab-span" style="white-space:pre"><div><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="Apple-tab-span" style="white-space:pre">H</span>ello</div> </span><br><div><div>Il giorno 13/lug/2011, alle ore 17.49, Ted Kremenek ha scritto:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 13, 2011, at 8:05 AM, David Blaikie wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; 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; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">So, options that seem to be being discussed include:<br><br>1) suppress this warning in all cases where the array is of length 1 and the last element in a struct<br> 1.1) refinement: only when the length is specified explicitly and not via macro expansion, etc. (as John suggested)<br> 1.2) refinement: under c99 recommend a fixup to use flexible arrays<br>2) split the warning in two, the second being the cases suppressed by the above option (probably less interesting if 1.1 is implemented)<br> </span></blockquote></div><br><div>(1) and (2) aren't mutually exclusive. (2) is still useful when the heuristics implied by 1.1 and 1.2 aren't good enough.</div></div></blockquote><br></div><div>I've tried to write such a patch, as it seemed simple, but I'm stuck because I don't know enough</div><div>about internal clang's APIs yet.</div><div>Until now, I've come up with the simple patch attached, that disables the warning if</div><div>the array is declared inside a record type and the size is one.</div><div>Questions:</div><div>- From the NamedDecl* object representing the array declaration, how do I know if it's declared last in the struct?</div><div>- From the NamedDecl*, how do I know if the size of the member declaration comes from a macro expansion?</div><div><br></div><div><br></div><div>Thanks,</div><div>Nicola</div><div><br></div><div></div></body></html>