1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 21:19:24 +00:00

Remove all occurrences of reinterpret_cast<>.

* src/keyword-list.h (Keyword_List): Add template parameter list <KT>.
(KeywordExt_List): Define as a typedef, not as a subclass.
(copy_list, delete_list, mergesort_list): Templatize accordingly.
* src/keyword-list.icc (Keyword_List): Add template parameter list <KT>.
(KeywordExt_List): Remove method definitions.
* src/keyword-list.cc (Keyword_List): Add template parameter list <KT>.
(copy_list, mergesort_list): Remove definitions on subclass.
Add explicit template instantiation.
* src/keyword.h (Keyword_Factory): Add template parameter list <KT>.
* src/keyword.cc (Keyword_Factory): Likewise.
Add explicit template instantiation.
* src/input.h (Input): Add template parameter list <KT>.
* src/input.cc (Input): Likewise. Add explicit template instantiation.
* src/main.cc (KeywordExt_Factory): Define as a typedef, not as a
subclass.
(main): Update.
This commit is contained in:
Bruno Haible
2025-04-05 14:18:27 +02:00
parent 67c697622f
commit a041291c80
9 changed files with 1060 additions and 1019 deletions

View File

@@ -1,5 +1,5 @@
/* Keyword data.
Copyright (C) 1989-1998, 2000, 2002-2003 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002-2003, 2025 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>.
@@ -136,13 +136,15 @@ KeywordExt::delete_selchars ()
/* ------------------------- Keyword_Factory class ------------------------- */
Keyword_Factory::Keyword_Factory ()
{
}
template <class KT>
Keyword_Factory<KT>::Keyword_Factory ()
{
}
Keyword_Factory::~Keyword_Factory ()
{
}
template <class KT>
Keyword_Factory<KT>::~Keyword_Factory ()
{
}
/* ------------------------------------------------------------------------- */
@@ -157,3 +159,19 @@ char empty_string[1] = "";
#undef INLINE
#endif /* not defined __OPTIMIZE__ */
/* ------------------------------------------------------------------------- */
/* Explicit template instantiations. Needed to avoid link-time errors.
C++ is just misdesigned: The most important aspect in building large
software packages is information hiding. (That's the point of having the
implementation of a .h file in a .cc file, isn't it? And of having
classes with private fields and methods, isn't it?) The fact that we
need the instantiation of the Keyword_Factory<KT> class only for
KT = KeywordExt comes from the code in main.cc. It is ugly that
implementation details of main.cc have an influence into this file here. */
template class Keyword_Factory<KeywordExt>;
/* ------------------------------------------------------------------------- */