...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>
When a rest argument is used in an IDL, it was previously just
generating a single Any argument for the constructor and then trying to
pass that directly to createInstanceWithArgumentsAndContext. That
doesn’t compile because that method requires an array of Anys for the
arguments parameter. Instead this patch makes it generate “params Any[]
rest” which seems to be the .NET way to do variadic arguments.
I don’t think there are any LibreOffice services using constructors with
rest parameters and presumably no one is using it outside of LO with
.NET because it wouldn’t compile, so hopefully this patch has little
risk. Fixing it enables us to use rest parameters in a future unit test
for pyuno.
Change-Id: I7dbf96f945011db546374ae1d6cf904a5bd262ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199135
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
After checking all modules with
bin/find-unneeded-includes --finderrors --headers --recursive
these subdirectories seemed to need custom assumes for an
error free run of IWYU
Change-Id: I8e0553355809e49e3ec3d06aa4404e6cd7b72aff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196631
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
This patch adds the unit and integration test suite for the pythonmaker
tool.
The test is orchestrated by a Python script and uses a "golden file"
comparison method. It runs `pythonmaker` on a comprehensive test IDL
and verifies that the generated `.pyi` output exactly matches a set of
pre-validated reference stubs.
The test is integrated into the build system and runs with 'make check'.
Change-Id: If91814767779812740c543476307600f61c8a656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188456
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
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>
After recent commit 851fb75779
recheck these directories in include/ again
to test drive the new --headersfwd mode of bin/find-unneeded-includes
Change-Id: I0ede437c4f9958cd98210ed1760a5b98ea8bd1ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192377
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
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>
fast_float implements C++17 from_chars for floating-point types, which
is still unavailable even in the latest versions of compilers e.g. for
macOS. It is maintained, unlike dtoa; it is said to be adopted as the
from_chars implementation for gcc. It is header-only, which simplifies
many things.
Change-Id: I6b597d4d35a076930e6e35f4f8cff3ca84f48ba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191248
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
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
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>
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>
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
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>
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
This commit introduces the 'pythonmaker' executable, a new tool in the
codemaker module.
pythonmaker generates Python type stub files (.pyi) from UNO IDL type
libraries (.rdb files). This enables static type checking and modern
IDE features like auto-completion for developers writing Python scripts for LibreOffice.
This commit includes the complete, feature-complete tool capable of handling all major IDL entity types (enums, constants, typedefs,
structs, exceptions, interfaces, services, and singletons).
Change-Id: I52f783aa982e1de04a207a9a884aee207f99d193
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185498
Tested-by: Jenkins
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
...to avoid
> error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)
(as would e.g. happen if offapi/org/libreoffice/embindtest/Constants.idl were
included in regular builds)
Change-Id: I6a4d8b151755edd3a8b03d73e2bb546cf1d19e7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174200
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This patch includes all marshalling and proxy handling code on the
.NET side as well as the native side needed for a fully functional
UNO bridge.
It also includes some changes and corrections to net_basetypes and
netmaker needed for the bridge to work properly.
It also includes the FirstUnoContact example in C# as demonstration.
Change-Id: I406932938a4415d24408fb41ddfa7d8eeb5d1f94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170916
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
This commit makes a few misc. fixes to netmaker and net_basetypes
- Renamed css.uno.Exception to css.uno.UnoException to avoid name
conflicts with System.Exception
- Added a new css.uno.Any constructor and setValue function that
deduces the type of the any from given object at runtime
- Changed the AnyTests unit tests to match changes made to css.uno.Any
- Removed the in keyword from UNO 'in' parameters. Was a premature
optimisation that might have a negative effect for certain types.
- Generated struct and exception field members were not marked public
earlier by accident, fixed.
- Generted struct and exception constructors had parameters in order
opposite to expected, fixed.
- Generated services tried to instantiate the interface, not the
service earlier, fixed.
Change-Id: Ia63f9db469db13a5d01617617095b8f568b39c72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171706
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
As Mike noticed, the pb is more general than just Base forms.
So here's the general fix suggested by Mike (thank you for the help!)
Change-Id: Ic57039c9c37f26d2ea2d0e0bda89f277ba7044cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171337
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Add new overloads to OUString methods that have a
"OUString* rest" style parameter.
Instead return a view, which does not require allocation.
To avoid overload ambiguity, split the methods into
different variants that do not use default parameters.
Change-Id: I1aa366115750f1f7ea4fe665804195f59f7c4b69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167632
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins