[patch] Removal of strfwd.h (was: When to use strfwd.h)

Enrico Forestieri forenr at lyx.org
Wed Oct 2 23:29:18 UTC 2024


On Tue, Oct 01, 2024 at 11:01:15PM +0200, Pavel Sanda wrote:
> 
>Enrico/Eugene/Stephan can you confirm you can compile and run master
>with the attached patch?

On cygwin compilation fails as follows:

make[5]: Entering directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
   CXX      trivstring.o
In file included from ../../../src/support/trivstring.cpp:13:
../../../src/support/../support/trivstring.h:41:22: error: ‘basic_string’ in namespace ‘std’ does not name a template type
    41 |         typedef std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> > _stdstring;
       |                      ^~~~~~~~~~~~
../../../src/support/../support/trivstring.h:17:1: note: ‘std::basic_string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    16 | #include <cstdlib>
   +++ |+#include <string>
    17 |
../../../src/support/../support/trivstring.h:49:34: error: expected ‘)’ before ‘const’
    49 |         trivial_string(_stdstring const & that);
       |                       ~          ^~~~~~
       |                                  )
../../../src/support/../support/trivstring.h:55:36: error: ‘_stdstring’ has not been declared
    55 |         trivial_string & operator=(_stdstring const & that);
       |                                    ^~~~~~~~~~
../../../src/support/../support/trivstring.h:67:18: error: expected type-specifier before ‘_stdstring’
    67 |         operator _stdstring() const;
       |                  ^~~~~~~~~~
../../../src/support/../support/trivstring.h:65:58: error: ‘_stdstring’ has not been declared
    65 |         trivial_string substr(size_t pos = 0, size_t n = _stdstring::npos) const;
       |                                                          ^~~~~~~~~~
../../../src/support/../support/trivstring.h:107:6: error: ‘basic_ostream’ in namespace ‘std’ does not name a template type
   107 | std::basic_ostream<Char, std::char_traits<Char> > &
       |      ^~~~~~~~~~~~~
../../../src/support/trivstring.cpp:58:10: error: template-id ‘__ct <>’ for ‘lyx::trivial_string<char>::trivial_string(const std::string&)’ does not match any template declaration
    58 | template trivial_string<char>::trivial_string(string const &);
       |          ^~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note: candidates are: ‘lyx::trivial_string<Char>::trivial_string(const Char*, size_t) [with Char = char; size_t = long unsigned int]’
    47 |         trivial_string(Char const * that, size_t n);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:45:9: note:                 ‘lyx::trivial_string<Char>::trivial_string(const lyx::trivial_string<Char>&) [with Char = char]’
    45 |         trivial_string(trivial_string const & that);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:43:9: note:                 ‘lyx::trivial_string<Char>::trivial_string() [with Char = char]’
    43 |         trivial_string() : size_(0), data_(0) {}
       |         ^~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:59:10: error: template-id ‘__ct <>’ for ‘lyx::trivial_string<unsigned int>::trivial_string(const lyx::docstring&)’ does not match any template declaration
    59 | template trivial_string<char_type>::trivial_string(docstring const &);
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note: candidates are: ‘lyx::trivial_string<Char>::trivial_string(const Char*, size_t) [with Char = unsigned int; size_t = long unsigned int]’
    47 |         trivial_string(Char const * that, size_t n);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:45:9: note:                 ‘lyx::trivial_string<Char>::trivial_string(const lyx::trivial_string<Char>&) [with Char = unsigned int]’
    45 |         trivial_string(trivial_string const & that);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:43:9: note:                 ‘lyx::trivial_string<Char>::trivial_string() [with Char = unsigned int]’
    43 |         trivial_string() : size_(0), data_(0) {}
       |         ^~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:61:37: error: expected constructor, destructor, or type conversion before ‘(’ token
    61 | trivial_string<Char>::trivial_string(_stdstring const & that)
       |                                     ^
../../../src/support/trivstring.cpp:104:1: error: template-id ‘operator=<>’ for ‘lyx::trivial_string<char>& lyx::trivial_string<char>::operator=(const std::string&)’ does not match any template declaration
   104 | trivial_string<char>::operator=(string const &);
       | ^~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:55:26: note: candidates are: ‘lyx::trivial_string<Char>& lyx::trivial_string<Char>::operator=(const int&) [with Char = char]’
    55 |         trivial_string & operator=(_stdstring const & that);
       |                          ^~~~~~~~
../../../src/support/../support/trivstring.h:53:26: note:                 ‘lyx::trivial_string<Char>& lyx::trivial_string<Char>::operator=(const lyx::trivial_string<Char>&) [with Char = char]’
    53 |         trivial_string & operator=(trivial_string const & that);
       |                          ^~~~~~~~
../../../src/support/trivstring.cpp:106:1: error: template-id ‘operator=<>’ for ‘lyx::trivial_string<unsigned int>& lyx::trivial_string<unsigned int>::operator=(const lyx::docstring&)’ does not match any template declaration
   106 | trivial_string<char_type>::operator=(docstring const &);
       | ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:55:26: note: candidates are: ‘lyx::trivial_string<Char>& lyx::trivial_string<Char>::operator=(const int&) [with Char = unsigned int]’
    55 |         trivial_string & operator=(_stdstring const & that);
       |                          ^~~~~~~~
../../../src/support/../support/trivstring.h:53:26: note:                 ‘lyx::trivial_string<Char>& lyx::trivial_string<Char>::operator=(const lyx::trivial_string<Char>&) [with Char = unsigned int]’
    53 |         trivial_string & operator=(trivial_string const & that);
       |                          ^~~~~~~~
../../../src/support/trivstring.cpp:109:1: error: declaration of ‘operator=’ as non-function
   109 | trivial_string<Char>::operator=(_stdstring const & that)
       | ^~~~~~~~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:109:33: error: ‘_stdstring’ was not declared in this scope
   109 | trivial_string<Char>::operator=(_stdstring const & that)
       |                                 ^~~~~~~~~~
../../../src/support/trivstring.cpp: In member function ‘lyx::trivial_string<Char> lyx::trivial_string<Char>::substr(size_t, size_t) const’:
../../../src/support/trivstring.cpp:168:18: error: ‘_stdstring’ has not been declared
   168 |         if (n == _stdstring::npos)
       |                  ^~~~~~~~~~
../../../src/support/trivstring.cpp: At global scope:
../../../src/support/trivstring.cpp:175:50: error: no member function ‘operator std::string’ declared in ‘lyx::trivial_string<char>’
   175 | template trivial_string<char>::operator string() const;
       |                                                  ^~~~~
../../../src/support/trivstring.cpp:176:58: error: no member function ‘operator lyx::docstring’ declared in ‘lyx::trivial_string<unsigned int>’
   176 | template trivial_string<char_type>::operator docstring() const;
       |                                                          ^~~~~
../../../src/support/trivstring.cpp:178:32: error: expected type-specifier before ‘_stdstring’
   178 | trivial_string<Char>::operator _stdstring() const
       |                                ^~~~~~~~~~
../../../src/support/trivstring.cpp:251:20: error: template-id ‘operator<< <>’ for ‘std::ostream& lyx::operator<<(std::ostream&, const trivial_string<char>&)’ does not match any template declaration
   251 | template ostream & operator<<(ostream &, trivial_string<char> const &);
       |                    ^~~~~~~~
In file included from ../../../src/support/trivstring.cpp:14:
../../../src/support/../support/docstring.h:59:21: note: candidate is: ‘lyx::odocstream& lyx::operator<<(odocstream&, char)’
    59 | extern odocstream & operator<<(odocstream &, char);
       |                     ^~~~~~~~
../../../src/support/trivstring.cpp:252:23: error: template-id ‘operator<< <>’ for ‘lyx::odocstream& lyx::operator<<(odocstream&, const trivial_string<unsigned int>&)’ does not match any template declaration
   252 | template odocstream & operator<<(odocstream &, trivial_string<char_type> const &);
       |                       ^~~~~~~~
../../../src/support/../support/docstring.h:59:21: note: candidate is: ‘lyx::odocstream& lyx::operator<<(odocstream&, char)’
    59 | extern odocstream & operator<<(odocstream &, char);
       |                     ^~~~~~~~
../../../src/support/trivstring.cpp: In instantiation of ‘bool lyx::operator==(const trivial_string<Char>&, const Char*) [with Char = char]’:
../../../src/support/trivstring.cpp:233:68:   required from here
../../../src/support/trivstring.cpp:238:28: error: no matching function for call to ‘lyx::trivial_string<char>::trivial_string(const char*&)’
   238 |         return lhs.compare(trivial_string<Char>(rhs)) == 0;
       |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const Char*, size_t) [with Char = char; size_t = long unsigned int]’
    47 |         trivial_string(Char const * that, size_t n);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note:   candidate expects 2 arguments, 1 provided
../../../src/support/trivstring.cpp:27:1: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const lyx::trivial_string<Char>&) [with Char = char]’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       | ^~~~~~~~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:27:61: note:   no known conversion for argument 1 from ‘const char*’ to ‘const lyx::trivial_string<char>&’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       |                                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../src/support/../support/trivstring.h:43:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string() [with Char = char]’
    43 |         trivial_string() : size_(0), data_(0) {}
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:43:9: note:   candidate expects 0 arguments, 1 provided
../../../src/support/trivstring.cpp: In instantiation of ‘bool lyx::operator==(const trivial_string<Char>&, const Char*) [with Char = unsigned int]’:
../../../src/support/trivstring.cpp:234:78:   required from here
../../../src/support/trivstring.cpp:238:28: error: no matching function for call to ‘lyx::trivial_string<unsigned int>::trivial_string(const unsigned int*&)’
   238 |         return lhs.compare(trivial_string<Char>(rhs)) == 0;
       |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const Char*, size_t) [with Char = unsigned int; size_t = long unsigned int]’
    47 |         trivial_string(Char const * that, size_t n);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note:   candidate expects 2 arguments, 1 provided
../../../src/support/trivstring.cpp:27:1: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const lyx::trivial_string<Char>&) [with Char = unsigned int]’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       | ^~~~~~~~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:27:61: note:   no known conversion for argument 1 from ‘const unsigned int*’ to ‘const lyx::trivial_string<unsigned int>&’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       |                                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../src/support/../support/trivstring.h:43:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string() [with Char = unsigned int]’
    43 |         trivial_string() : size_(0), data_(0) {}
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:43:9: note:   candidate expects 0 arguments, 1 provided
../../../src/support/trivstring.cpp: In instantiation of ‘bool lyx::operator==(const Char*, const trivial_string<Char>&) [with Char = char]’:
../../../src/support/trivstring.cpp:242:68:   required from here
../../../src/support/trivstring.cpp:247:28: error: no matching function for call to ‘lyx::trivial_string<char>::trivial_string(const char*&)’
   247 |         return rhs.compare(trivial_string<Char>(lhs)) == 0;
       |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const Char*, size_t) [with Char = char; size_t = long unsigned int]’
    47 |         trivial_string(Char const * that, size_t n);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note:   candidate expects 2 arguments, 1 provided
../../../src/support/trivstring.cpp:27:1: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const lyx::trivial_string<Char>&) [with Char = char]’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       | ^~~~~~~~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:27:61: note:   no known conversion for argument 1 from ‘const char*’ to ‘const lyx::trivial_string<char>&’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       |                                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../src/support/../support/trivstring.h:43:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string() [with Char = char]’
    43 |         trivial_string() : size_(0), data_(0) {}
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:43:9: note:   candidate expects 0 arguments, 1 provided
../../../src/support/trivstring.cpp: In instantiation of ‘bool lyx::operator==(const Char*, const trivial_string<Char>&) [with Char = unsigned int]’:
../../../src/support/trivstring.cpp:243:78:   required from here
../../../src/support/trivstring.cpp:247:28: error: no matching function for call to ‘lyx::trivial_string<unsigned int>::trivial_string(const unsigned int*&)’
   247 |         return rhs.compare(trivial_string<Char>(lhs)) == 0;
       |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const Char*, size_t) [with Char = unsigned int; size_t = long unsigned int]’
    47 |         trivial_string(Char const * that, size_t n);
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:47:9: note:   candidate expects 2 arguments, 1 provided
../../../src/support/trivstring.cpp:27:1: note: candidate: ‘lyx::trivial_string<Char>::trivial_string(const lyx::trivial_string<Char>&) [with Char = unsigned int]’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       | ^~~~~~~~~~~~~~~~~~~~
../../../src/support/trivstring.cpp:27:61: note:   no known conversion for argument 1 from ‘const unsigned int*’ to ‘const lyx::trivial_string<unsigned int>&’
    27 | trivial_string<Char>::trivial_string(trivial_string const & that) : size_(that.size_)
       |                                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../src/support/../support/trivstring.h:43:9: note: candidate: ‘lyx::trivial_string<Char>::trivial_string() [with Char = unsigned int]’
    43 |         trivial_string() : size_(0), data_(0) {}
       |         ^~~~~~~~~~~~~~
../../../src/support/../support/trivstring.h:43:9: note:   candidate expects 0 arguments, 1 provided
make[5]: *** [Makefile:948: trivstring.o] Error 1
make[5]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
make[4]: *** [Makefile:798: all] Error 2
make[4]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
make[3]: *** [Makefile:2397: all-recursive] Error 1
make[3]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src'
make[2]: *** [Makefile:1495: all] Error 2
make[2]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src'
make[1]: *** [Makefile:568: all-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin'
make: *** [Makefile:462: all] Error 2

-- 
Enrico


More information about the lyx-devel mailing list