0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 12:41:06 +08:00

1819 Commits

Author SHA1 Message Date
Arseny Kapoulkine
8c3038f9c8 Update CMake version to 3.5...3.30
This should retain compatibility with earlier version of CMake and suppress
the deprecation warning for quite some time.
2024-11-17 08:25:06 +09:00
Arseny Kapoulkine
f1f532acfc docs: Reword last bullet point of thread safety guarantees
This was worded somewhat confusingly; we should be explicit that it's
okay to access multiple documents concurrently as long as access to each
one is serialized.
2024-11-05 07:43:54 -08:00
Arseny Kapoulkine
3480faa837
Merge pull request #642 from zeux/string-view-def
Auto-detect std::string_view support by default
2024-11-04 10:20:38 -08:00
Arseny Kapoulkine
0f22f71f60 CMake now uses C++17 if supported by the compiler
We only set this when C++ version or requirement flag is not overridden
externally to be able to rely on CMake automatically downgrading the
standard version when the compiler doesn't support it.

CXX_STANDARD 17 also requires CMake 3.8 or later; on earlier versions we
use the old behavior and set C++11.
2024-10-30 14:18:39 -07:00
Arseny Kapoulkine
781e2dbe5d
Merge pull request #643 from zeux/cmake-test
Enhance CMake testing in CI
2024-10-30 14:10:26 -07:00
Arseny Kapoulkine
f1f1b4e0dd Add basic CMake testing to AppVeyor
To reduce build time impact we just do a quick smoke test (configure &
build).
2024-10-30 13:27:13 -07:00
Arseny Kapoulkine
25b508056c Add unix-cmake test to GHA
To not inflate the build matrix too much, just use the default settings;
we mostly need this to test the CMake flow, not to test the actual code.
2024-10-30 13:02:56 -07:00
Arseny Kapoulkine
ae163d5f06 Enable C++17 support in VS2019 and VS2022 projects
This enables std::string_view support for NuGet builds
2024-10-30 11:46:36 -07:00
Arseny Kapoulkine
af6cbeb170 Enable C++17 standard in AppVeyor tests
To avoid increasing the build matrix we enable this unconditionally for
VS2019 and VS2022 to be able to test std::string_view. Note that we
already test VS2022 without this flag on GHA so this should catch any
regressions.
2024-10-30 11:25:17 -07:00
Arseny Kapoulkine
d5f14adb3c docs: Update documentation to address PUGIXML_HAS_STRING_VIEW changes
The PUGIXML_STRING_VIEW define is no longer necessary but
_HAS_STRING_VIEW can be enabled manually if the compiler supports it
without advertising C++17 support.
2024-10-30 10:36:36 -07:00
Arseny Kapoulkine
ca4f7cfecc Auto-detect std::string_view support by default
Instead of opting in std::string_view support via PUGIXML_STRING_VIEW
define, always enable it when C++17 is supported; this still requires
enabling C++17 support in the compiler, which this change doesn't
attempt to do yet.
2024-10-30 10:31:49 -07:00
dantargz
4d0043fb6c
Update VERSION in Makefile and add documentation for string_view_t (#641)
We now document PUGIXML_HAS_STRING_VIEW and PUGIXML_STRING_VIEW (the latter will be removed in the future) configuration as well as string_view_t type and overloads.

Makefile also had to be fixed to recognize the version properly after pugixml.hpp changes.
2024-10-28 08:06:42 -07:00
Arseny Kapoulkine
2729d80c94
Makefile now defaults to cxxstd=any (#639)
This means that by default we inherit the default language version
supported by the compiler; this will help with string_view testing
in the future as it will "just work" out of the box once the define is
set.

This should also automatically enable CI coverage for string_view; C++11
is still explicitly tested in CI via cxxstd=c++11.
2024-10-28 08:05:36 -07:00
Arseny Kapoulkine
23e617b158
Warn if PUGIXML_STRING_VIEW is set without CMAKE_CXX_STANDARD (#638)
Even if the compiler supports C++17, we define CMAKE_CXX_STANDARD as 11
by default which implicitly disables string_view support; for now warn
in this case.
2024-10-26 10:20:06 -07:00
dantargz
13beda24b8
Add remaining std::string_view overloads (#636)
Add remaining overloads and supporting unit tests. This concludes the initial phase of std::string_view support; for now the support is still opt-in via PUGIXML_STRING_VIEW define, but that will become unnecessary (enabled-by-default) in a future version.
2024-10-24 14:10:09 -07:00
Arseny Kapoulkine
7e702740ff
Merge pull request #623 from r-barnes/master
throw() -> noexcept
2024-10-22 18:59:45 -07:00
Arseny Kapoulkine
d713fd2315
Define PUGIXML_NOEXCEPT as throw()
This is necessary to avoid gcc warnings for exception::what()
2024-10-22 13:36:47 -07:00
dantargz
a0db6e2185
Initial support for std::string_view (#633)
When PUGIXML_STRING_VIEW define is set and C++17 is available, add std::string_view support to a few functions. In the future, string view support will be enabled without the need for an extra define, but for now the support is opt-in to reduce compatibility risks.

PR is based on initial contribution by @brandl-muc.
2024-10-22 13:31:54 -07:00
Arseny Kapoulkine
3b17184379 docs: Work around asciidoc bug with TOC numbering
For some reason using a code import right before a header breaks
numbering on that header; fix by moving the import above text.
2024-09-12 09:49:35 -07:00
Richard Barnes
6247ece208 throw() -> noexcept 2024-07-16 06:48:23 -07:00
Arseny Kapoulkine
30cc354fe3
Merge pull request #621 from aral-matrix/master
xmldocument::save: use encoding interpreted by get_write_encoding in buffered_writer constructor
2024-07-08 09:35:57 -07:00
aral-matrix
2039e448cf use encoding interpreted by get_write_encoding in buffered_writer constructor 2024-07-07 11:19:52 +02:00
Arseny Kapoulkine
2d42114ed1
Merge pull request #620 from zeux/nostl-warnfix
Work around 'unreferenced function' warnings in NO_STL builds
2024-07-06 08:55:52 -07:00
Arseny Kapoulkine
c691c6b401 Work around 'unreferenced function' warnings in NO_STL builds
Normally, as_utf8_begin et al are used in STL functions but when STL is
disabled, these are only used if the target platform lacks first class
support for wchar_t FILE* APIs. With some warning levels we consequently
can get warnings about these functions not being referenced.

Not defining these in the first place is difficult because of the
complexity of the selection logic for open_file_wide so for now just
mark these as unused. The strange (void)& syntax is needed for MSVC to
not trigger another warning...

The workaround is narrowly scoped to avoid unforeseen compatibility issues.

Fixes #619.
2024-07-05 15:43:55 -07:00
Arseny Kapoulkine
ac0ef854e0 Clarify comments for xml_*::empty()
"empty" can be mistaken for "has no children" in case of xml_node in
particular; we now use both empty and null in the comment in hopes that
it may help.
2024-05-28 20:39:08 -07:00
Arseny Kapoulkine
7c66cf7b06 docs: Add C++20 ranges documentation
This doesn't require any implementation changes, as the existing support
for C++11 ranged for loops automatically makes nodes and node/attribute
range objects work as C++20 ranges.

Fixes #613.
2024-05-19 13:24:34 -07:00
Arseny Kapoulkine
f1d8c51ec8
Merge pull request #611 from kmilos/patch-1
Relative and absolute paths for a relocatable pkgconf file
2024-03-23 09:44:03 -07:00
Miloš Komarčević
08e38a4c14
Relative and absolute paths for a relocatable pkgconf file 2024-03-22 14:05:43 +01:00
Miloš Komarčević
6ab3fa418b
Update pugixml.pc.in 2024-03-22 14:00:34 +01:00
Arseny Kapoulkine
b2b4664030 docs: Adjust docs wrt parse_merge_pcdata x parse_embed_pcdata
parse_merge_pcdata expects to find node_pcdata nodes which aren't
present when parse_embed_pcdata is active. For now we mention this in
the documentation; changing this is possible in the future, but carries
a small performance penalty so it requires a specific use case.

Fixes #600
2024-01-26 09:23:26 -08:00
Arseny Kapoulkine
3cc2daf449 Update year to 2024 everywhere
... except .html files that will be regenerated later.
2024-01-26 09:18:48 -08:00
Arseny Kapoulkine
96aebcb8ae
Merge pull request #604 from zeux/ndk-warnfix
Fix -Wshorten-64-to-32 warning on Android NDK when targeting x86
2023-12-23 10:48:31 -08:00
Arseny Kapoulkine
86591a97c3 Extract length validation and conversion function into a templated function
Since there's no reasonable way for us to figure out what the type of
stat::st_size is on Android NDK without resorting to C++11 auto /
non-standard decltype extensions, we're going to resort to a templated
function that can deduce the length type. The rest of the validation and
conversion logic is preserved as is.
2023-12-23 09:30:57 -08:00
Arseny Kapoulkine
8fef4591be Fix -Wshorten-64-to-32 warning on Android NDK when targeting x86
stat.h defines struct stat to use long long on Android NDK when
targeting x86; off_t however is defined as long, which is 32-bit (unlike
other Unix-like platforms). This results in a narrowing conversion which
produces a warning, and can also result in silently reading a prefix of
a huge file instead of a clean "out of memory" error.

There's no way for us to preserve the type exactly but always widening
to long long should be safe; get_file_size will proceed to check if
length actually fits into size_t which is what we ultimately need, and
that overflow check will fail on files that are >4 GB in size.
2023-12-20 11:19:42 -08:00
Arseny Kapoulkine
cf466ce2a2
Merge pull request #595 from zeux/stl-defarg
Use cleaner references to STL classes
2023-11-16 12:42:22 -08:00
Arseny Kapoulkine
499750ad95
Merge pull request #596 from zeux/appvmp
AppVeyor build optimizations
2023-11-16 12:32:28 -08:00
Arseny Kapoulkine
cd420ab193 Use make -j2 for mingw builds on AppVeyor 2023-11-16 12:12:56 -08:00
Arseny Kapoulkine
d99aa003ba Restrict AppVeyor builds to master branch
This avoids duplicate builds on PRs submitted from a branch in the same
repository.
2023-11-16 12:09:18 -08:00
Arseny Kapoulkine
1e3d6f15f5 tests: Add /MP to AppVeyor builds to try to reduce build time 2023-11-16 11:27:40 -08:00
Arseny Kapoulkine
2e8a2a4e1c tests: Work around -Wself-move in new gcc
We do want to test self-move; fortunately, hiding the object reference
behind a separate pointer variable silences the warning.
2023-11-16 10:54:53 -08:00
Arseny Kapoulkine
0bd2848f33 Use cleaner references to STL classes
The explicit specification of default template arguments is repetitive
and dates back to the versions of pugixml that tried to forward-declare
all STL classes manually, which ran into issues with default arguments
in some STL versions.

We've since abandoned this idea and use <string>/<iosfwd> includes, as
such it should be fine to rely on default arguments.

Note: while we could use std::wstring, this had compatibility issues
with some very early versions of Android SDK. Out of abundance of
caution, we keep basic_i/ostream and basic_string in tact. We could use
std::string but we might need to replace these in char8 mode if that
ever gets merged.
2023-11-16 10:51:20 -08:00
Arseny Kapoulkine
43d7d568a7
Merge pull request #594 from SoapGentoo/Wuseless-cast
Fix `-Wuseless-cast`
2023-11-14 07:13:09 -08:00
David Seifert
44236fef2c
Fix -Wuseless-cast 2023-11-13 20:53:44 -08:00
Arseny Kapoulkine
6909df2478
Merge pull request #590 from zeux/sanfuzz
Update config=sanitize and fuzz targets
2023-10-22 11:18:08 -07:00
Arseny Kapoulkine
b15bc6bf1f Update config=sanitize and fuzz targets
We used to need to silence float-divide-by-zero and float-cast-overflow
sanitizers since clang used a finite valid floating point value range.
Fortunately, since clang-9 UBSAN properly handles various primitive
operations per IEEE-754 so we no longer need this workaround.

Also use fork=16 mode for fuzz targets to make it easier to run fuzzing
locally.
2023-10-22 10:07:52 -07:00
Arseny Kapoulkine
33f709379a
Merge pull request #551 from silvergasp/master
fuzzer: excersizes query code on xml doc
2023-10-21 12:29:22 -07:00
Arseny Kapoulkine
4d42ba7a60
Update fuzz_xpath.cpp
Remove unused variables
2023-10-21 11:20:03 -07:00
Arseny Kapoulkine
d75a081aa3
Update fuzz_xpath.cpp
Fix code style, no exceptions, other tweaks.
2023-10-21 11:11:11 -07:00
Arseny Kapoulkine
1ade1d4bea
Merge pull request #586 from PhilipBotha/fix/nullptr_const_zero
Replaced 0 with PUGIXML_NULL when a nullptr would have been needed.
2023-10-19 19:21:08 -07:00
Arseny Kapoulkine
94b19a3c45 Fix indentation changes 2023-10-15 19:25:56 -07:00