On Mon, 9 Mar 2020 18:02:21 +0000 "Medvedkin, Vladimir" <vladimir.medved...@intel.com> wrote:
> On 09/03/2020 15:52, Stephen Hemminger wrote: > > On Mon, 9 Mar 2020 13:38:53 +0000 > > "Medvedkin, Vladimir" <vladimir.medved...@intel.com> wrote: > > > >> Hi Andrze, > >> > >> Adding const qualifier for bulk lookup leads to compilation problems > >> (see http://c-faq.com/ansi/constmismatch.html) > >> Also I don't think it would be good for usability to make users > >> explicitly cast to (const uint8_t **) when passing 'ips' argument. I'd > >> suggest leaving lookup_bulk as is. > > > > Please give a more concrete example. There is no need for explicit cast > > in current C. > > Hi Stephen, > > In theory, i agree - all modern versions of GCC don't give warnings for > this code. The problem is, we don't only support modern versions of GCC. > For a "more concrete example", see the following error in gcc-4.8 on > CentOS 7: > > http://mails.dpdk.org/archives/test-report/2020-March/119455.html > > I have reproduced this on my non-CentOS machine with gcc4.8, so it > appears to be gcc4.8 specific rather than CentOS-specific. That said, > the same email contains a compile check from RHEL7 with the same > compiler version, and it didn't trigger the warning, and also it seems > to be that only meson build has triggered the warning (while i have > reproduced it with make on my machine). > > So, i think it is best to leave lookup_bulk as is, and add const > qualifiers in other places (for const uint8_t *). > Agree, just drop it from the bulk functions. The array of array semantics is confusing compiler (and users).