On 01/04/2013, at 8:49 PM, wei...@apache.org wrote: > Updated Branches: > refs/heads/master 366fab2ae -> 3050ce9bd > > > TS-1713 just make ts can build on clang > > > Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo > Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3050ce9b > Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3050ce9b > Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3050ce9b > > Branch: refs/heads/master > Commit: 3050ce9bdfe65016b93d26d213d76cf39d46e804 > Parents: 366fab2 > Author: weijin <taorui...@taobao.com> > Authored: Tue Apr 2 11:47:29 2013 +0800 > Committer: weijin <taorui...@taobao.com> > Committed: Tue Apr 2 11:48:07 2013 +0800 > > ---------------------------------------------------------------------- > iocore/hostdb/I_HostDBProcessor.h | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3050ce9b/iocore/hostdb/I_HostDBProcessor.h > ---------------------------------------------------------------------- > diff --git a/iocore/hostdb/I_HostDBProcessor.h > b/iocore/hostdb/I_HostDBProcessor.h > index 1408810..28f1647 100644 > --- a/iocore/hostdb/I_HostDBProcessor.h > +++ b/iocore/hostdb/I_HostDBProcessor.h > @@ -355,11 +355,12 @@ struct HostDBRoundRobin > unsigned short length; > ink_time_t timed_rr_ctime; > > - HostDBInfo info[]; > + HostDBInfo info[1];
I'm not sure that this really addresses the issue. The clang warning is telling us that it's dangerous to use manual memory management trick with non-POD data types. I'd tend to agree with this. We should turn HostDBInfo into a POD and add some static init functions to use as constructors/destructors (eg. the init code in HostDBContinuation::dnsEvent() is pretty janky. > > static int size(int nn, int srv_len = 0) > { > - return INK_ALIGN((int) (sizeof(HostDBRoundRobin) + nn * > sizeof(HostDBInfo) + srv_len), 8); > + ink_assert(nn > 0); > + return INK_ALIGN((int) (sizeof(HostDBRoundRobin) + (nn-1) * > sizeof(HostDBInfo) + srv_len), 8); > } > > /** Find the index of @a addr in member @a info. >