Commit Graph
17 Commits
Author SHA1 Message Date
Stephan Bergmann 727d62727e Fix --with-latest-c++ build against libstdc++ 16
(e.g., libstdc++-devel-16.1.1-2.fc44.x86_64) after
f320d95d89ecc9bea81182795969f83b05ec903c "Avoid deprecated
std::filesystem::path::string",

> In file included from engine/codemaker/source/netmaker/netproduce.cxx:19:
> engine/codemaker/source/netmaker/csharpfile.hxx: In member function ‘std::string CSharpFile::getPath() const’:
> engine/codemaker/source/netmaker/csharpfile.hxx:31:27: error: ‘const class std::filesystem::__cxx11::path’ has no member named ‘display_string’
>    31 |         return m_filePath.display_string();
>       |                           ^~~~~~~~~~~~~~

etc.

Signed-off-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Change-Id: Ib51f9e0d0e1f902726f0d68a11fe28110388ef6a
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6554
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 63e9ab3b87cc5a793c8733e375dc86d99419a88d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208277
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-21 00:09:20 +02:00
Stephan Bergmann 0e2ad911d9 Avoid deprecated std::filesystem::path::string
...and std::filesystem::path::generic_string, which at least GCC 17 trunk
libstdc++ now flags for C++26 (--with-latest-c++) as

> In file included from engine/codemaker/source/netmaker/netproduce.cxx:19:
> engine/codemaker/source/netmaker/csharpfile.hxx:28:53: error: 'string' is deprecated: use 'display_string' or 'native_encoded_string' instead [-Werror,-Wdeprecated-declarations]
>    28 |     std::string getPath() const { return m_filePath.string(); }
>       |                                                     ^
> ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/17.0.0/../../../../include/c++/17.0.0/bits/fs_path.h:465:5: note: 'string' has been explicitly marked deprecated here
>   465 |     _GLIBCXX26_DEPRECATED_SUGGEST("display_string' or 'native_encoded_string")
>       |     ^
> ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/17.0.0/../../../../include/c++/17.0.0/x86_64-pc-linux-gnu/bits/c++config.h:160:45: note: expanded from macro '_GLIBCXX26_DEPRECATED_SUGGEST'
>   160 | # define _GLIBCXX26_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT)
>       |                                             ^
> ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/17.0.0/../../../../include/c++/17.0.0/x86_64-pc-linux-gnu/bits/c++config.h:112:19: note: expanded from macro '_GLIBCXX_DEPRECATED_SUGGEST'
>   112 |   __attribute__ ((__deprecated__ ("use '" ALT "' instead")))
>       |                   ^

since
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=341ad729c2c93b9f01854913b0404e4fc8958512>
"libstdc++: Add (generic_)display_string and (generic_)native_encoded_string to
filesystem::path".

Occurrences that are obviously meant for display purposes are #if-conditionally
replaced with the new display_string, while all other occurrences are left using
the (non-deprecated) [generic_]string<char> template instantiation, matching the
original code.  (Where, for C++26, the latter could also be replaced with the
new [generic_]native_encoded_string, aka [generic_]system_encoded_string; see
<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2319r5.html>
"Prevent path presentation problems" and
<https://cplusplus.github.io/LWG/issue4512> "The system_encoded_string() and
generic_system_encoded_string() member functions of std::filesystem::path are
misnamed" for details.)

Signed-off-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Change-Id: I7c79c8522608550bb1e0f4cb8e4824480952446b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3987
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f320d95d89ecc9bea81182795969f83b05ec903c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206226
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-09 09:52:05 +02:00
Arnaud VERSINI fc76052495 rust : use repr(transparent) when we should
Change-Id: Iaf8334aa8d83c170454dffc8438395a395246938
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198557
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
Tested-by: Jenkins
2026-04-28 08:13:34 +02:00
Arnaud VERSINI 36eeec7eee rust code maker : use constexpr sets and maps
Change-Id: Iffedaf0075abda2c6b1de24dea4c28aa2dd26282
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194067
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
Tested-by: Jenkins
2026-02-07 18:53:58 +01:00
Rene Engelhard 8985ebd92e fix --enable-rust-uno build after fd2e467ba3320c99d8f4856784c7ccd0912a08a7(?)
as in fd2e467ba3 for netproduce.cxx

/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx: In member function ‘rtl::OString RustProducer::resolveTypedef(std::u16string_view) const’:
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx:1421:43: error: ‘Typedef’ is not a member of ‘codemaker::UnoType::Sort’
 1421 |     if (sort == codemaker::UnoType::Sort::Typedef)
      |                                           ^~~~~~~
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx: In member function ‘bool RustProducer::isUnoInterface(std::u16string_view) const’:
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx:1713:46: error: ‘Interface’ is not a member of ‘codemaker::UnoType::Sort’
 1713 |     return sort == codemaker::UnoType::Sort::Interface;
      |                                              ^~~~~~~~~
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx: In member function ‘bool RustProducer::isUnoStruct(std::u16string_view) const’:
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx:1721:46: error: ‘PlainStruct’ is not a member of ‘codemaker::UnoType::Sort’
 1721 |     return sort == codemaker::UnoType::Sort::PlainStruct;
      |                                              ^~~~~~~~~~~
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx: In member function ‘bool RustProducer::isUnoEnum(std::u16string_view) const’:
/home/rene/LibreOffice/git/master/codemaker/source/rustmaker/rustproduce.cxx:1729:46: error: ‘Enum’ is not a member of ‘codemaker::UnoType::Sort’
 1729 |     return sort == codemaker::UnoType::Sort::Enum;
      |                                              ^~~~

Change-Id: I36c97fcfec14fb075d67aa4e1550dadba7499aa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193621
Tested-by: Jenkins
Reviewed-by: René Engelhard <rene@debian.org>
2025-11-08 19:31:30 +01:00
Mike Kaganski 5ab2021005 enable-msvc-analyze: C4310: cast truncates constant value
C:/lo/core/codemaker/source/rustmaker/type_analyzer.cxx(165): warning C4310: cast truncates constant value

Change-Id: I5be672810ff5501c40d98940c328f8e181a06f39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193175
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-10-30 07:00:24 +01:00
Stephan Bergmann 5429ad357b Fix loplugin warnings in --enable-rust-uno code
...an assortment of loplugin:staticmethods, loplugin:stringadd, and
loplugin:stringviewparam

Change-Id: Iaa62c0162014a31de7d1f910199f241747f2feea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193167
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2025-10-29 22:37:20 +01:00
Mohamed Ali 86ade63863 Rust Bindings: Use typed parameters instead of void* in UNO bindings
Replace generic void* parameters with proper types (strings, primitives, structs) for better type safety and more idiomatic Rust code.

Change-Id: Iced1c2de96564be7ec599f14bf1a685eaede2768
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191477
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2025-09-29 09:57:43 +02:00
Mohamed Ali 048761fb22 Rust Bindings: Refactor RustProducer and CppProducer
Change-Id: I3b40c7a7eb572d95b91d1ec8eeda17a971331f67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191476
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2025-09-29 09:57:35 +02:00
Andrea Gelmini 2b44a63884 Fix typo
Change-Id: I3a5ea43f88b080394504336ed864a0b771ac6f73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190875
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2025-09-13 11:22:29 +02:00
Michael Weghorn 257f798461 rustmaker: Avoid string copy (loplugin:stringview)
Address the following clang plugin error seen in an
--enable-rust-uno build:

    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1016:41: error: rather than copy, pass with a view using subView() [loplugin:stringview]
     1016 |                             && (unoType.copy(unoType.lastIndexOf('.') + 1).startsWith("X")));
          |                                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: Icec8b529abf67ca13243da21136d5f296f53b7d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190854
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-09-12 13:57:19 +02:00
Michael Weghorn 5ecb0b6f95 rustmaker: Use more string_view params, address loplugin:unnecessarygetstr
Switch some params from const std::string& to std::string_view
and drop the then unnecessery calls to OString::getStr in
callers.

This fixes the following clang plugin errors seen in an
--enable-rust-uno build:

    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1070:88: error: unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr]
     1070 |     generateStructSourceBasicFunctions(file, functionPrefix, handleTypeName, className.getStr());
          |                                                                              ~~~~~~~~~~^~~~~~~~
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1073:85: error: unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr]
     1073 |     generateStructSourceBaseMembers(file, functionPrefix, handleTypeName, className.getStr(),
          |                                                                           ~~~~~~~~~~^~~~~~~~
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1077:87: error: unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr]
     1077 |     generateStructSourceDirectMembers(file, functionPrefix, handleTypeName, className.getStr(),
          |                                                                             ~~~~~~~~~~^~~~~~~~

Change-Id: Ia0ad68dd2dfed3a9b807c284e474ae0f2e42b2b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190853
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-09-12 13:57:10 +02:00
Michael Weghorn 292f5fe5d5 rustmaker: Use string_view params (loplugin:stringviewparam)
Fix clang plugin errors like the following seen in an
--enable-rust-uno build:

    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:207:77: error: replace function parameter of type 'const OString &' with 'std::string_view' [loplugin:stringviewparam]
      207 | void CppProducer::generateCBridgeConstructors(CppFile& file, const OString& className,
          |                                                              ~~~~~~~~~~~~~~~^~~~~~~~~
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.hxx:177:75: note: previous declaration is here [loplugin:stringviewparam]
      177 |     static void generateCBridgeConstructors(CppFile& file, const OString& className,
          |                                                            ~~~~~~~~~~~~~~~^~~~~~~~~

Change-Id: I5d5fa38d735a63438395848d6038f9d0e8e40401
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190852
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-09-12 13:57:03 +02:00
Michael Weghorn cc9c0bac1f rustmaker: Make methods static (loplugin:staticmethods)
Fix clang plugin errors like the following seen in an
--enable-rust-uno build:

    In file included from /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:10:
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.hxx:177:10: error: this member function can be declared static [loplugin:staticmethods]
      177 |     void generateCBridgeConstructors(CppFile& file, const OString& className,
          |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      178 |                                      const OString& functionPrefix, const OString& handleTypeName);
          |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I7d2ae9ba71da8a6db73101e177610e9ec0df7616
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190850
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-09-12 13:56:56 +02:00
Michael Weghorn 8b513dcebb rustmaker: Make loplugin:simplifyconstruct happy
Fix this clang plugin error seen in an
--enable-rust-uno build:

    .../libreoffice/codemaker/source/rustmaker/cpp_include_manager.cxx:138:17: error: simplify construction, just use 'Foo a(...);' [loplugin:simplifyconstruct]
      138 |     std::string targetTypeStr = std::string(targetType);
          |     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

Change-Id: Idf5e672e65e4029686a6c2cd4ca5b9dde7de3e72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190849
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-09-12 13:56:51 +02:00
Michael Weghorn 82df59fa8e rustmaker: Use OString literals (loplugin:ostr)
This fixes clang plugin errors like the following
seen in an --enable-rust-uno build:

    .../libreoffice/codemaker/source/rustmaker/rustproduce.cxx:1063:16: error: use a _ostr user-defined string literal instead of constructing an instance of 'OString' from an ordinary string literal [loplugin:ostr]
     1063 |         return "u8";
          |                ^~~~

Change-Id: I5891641b80b46e19f1ceb401e48b6a8fb0286e58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190848
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-09-12 13:56:29 +02:00
Mohamed Ali d9f05dc007 Rust Bindings: Add rustmaker (Rust codemaker)
The rustmaker provides comprehensive support for converting UNO type definitions into idiomatic Rust code with proper memory safety and type system integration.

Also adds the RustFile, RustOptions, and RustProducer classes to handle
Rust code generation, file management, and command line option parsing
for various UNO type kinds such as enums, structs, and interfaces.

Change-Id: Iaf87af13352c55e81c1745ef7a8f591c3e61e0a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188088
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2025-09-11 21:38:59 +02:00