On Wed, Oct 31, 2018 at 5:40 PM Martin Liška <mli...@suse.cz> wrote: > > Hi. > > As seen in r265663 having htab_hash_string accepting const char * would > report a compilation error. The void * argument is needed for old C-style > htab used in libiberty. I'm suggesting to come up with htab_hash_string_vptr > and > change signature of the old one (htab_hash_string). And putting these into > hashtab.h will make it inlinable in C++-style hash table. > > Patch survives regression tests on ppc64le-linux-gnu. > Total cc1 change with the patch: > +0.0% +2.09Ki > > Hope it's acceptable.
What's the reason to inline the implementation? I guess you want to get a compilation error when calling htab_hash_string on a non-string? But then libiberty isn't C++ an is used in other projects which you may be breaking with your patch? A solution might be to poison htab_hash_string and provide our own variant. Richard. > Thanks, > Martin > > gcc/ChangeLog: > > 2018-10-31 Martin Liska <mli...@suse.cz> > > * gengtype-state.c (read_state): Use newly added > htab_hash_string_vptr. > * gensupport.c (gen_mnemonic_attr): Likewise. > (check_define_attr_duplicates): Likewise. > * godump.c (go_finish): Likewise. > > include/ChangeLog: > > 2018-10-31 Martin Liska <mli...@suse.cz> > > * hashtab.h (htab_hash_string): Change signature > to const char * and make it static inline. > (htab_hash_string_vptr): Likewise. > > libcpp/ChangeLog: > > 2018-10-31 Martin Liska <mli...@suse.cz> > > * files.c (_cpp_init_files): Use htab_hash_string_vptr. > > libiberty/ChangeLog: > > 2018-10-31 Martin Liska <mli...@suse.cz> > > * hashtab.c: > (htab_hash_string): Move to header file. > --- > gcc/gengtype-state.c | 2 +- > gcc/gensupport.c | 4 ++-- > gcc/godump.c | 6 +++--- > include/hashtab.h | 47 ++++++++++++++++++++++++++++++++++++++++++-- > libcpp/files.c | 2 +- > libiberty/hashtab.c | 38 ----------------------------------- > 6 files changed, 52 insertions(+), 47 deletions(-) > >