Skip to content

Commit

Permalink
[libodb] Fix compilation errors under Linux (#38352)
Browse files Browse the repository at this point in the history
Fix one of [32398](#32398)
issue.
```
/mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.hxx:38:49: error: ISO C++17 does not allow dynamic exception specifications
   38 | operator new (std::size_t, odb::details::share) throw (std::bad_alloc);
      |                                                 ^~~~~
/mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.hxx:65:34: error: ISO C++17 does not allow dynamic exception specifications
   65 |       operator new (std::size_t) throw (std::bad_alloc);
      |                                  ^~~~~
/mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.hxx:68:41: error: ISO C++17 does not allow dynamic exception specifications
   68 |       operator new (std::size_t, share) throw (std::bad_alloc);
      |                                         ^~~~~
In file included from /mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.hxx:108,
                 from /mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.cxx:5:
/mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.ixx:67:34: error: ISO C++17 does not allow dynamic exception specifications
   67 |     operator new (std::size_t n) throw (std::bad_alloc)
      |                                  ^~~~~
/mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.ixx:73:41: error: ISO C++17 does not allow dynamic exception specifications
   73 |     operator new (std::size_t n, share) throw (std::bad_alloc)
      |                                         ^~~~~
/mnt/vcpkg/buildtrees/libodb/src/libodb-2-59eaf93c2b.clean/odb/details/shared-ptr/base.cxx:57:48: error: ISO C++17 does not allow dynamic exception specifications
   57 | operator new (size_t n, odb::details::share s) throw (std::bad_alloc)
```
Fix the syntax not supported by C++17 and modify the export file name.
- [X] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] ~~SHA512s are updated for each updated download.~~
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [X] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [X] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [X] Only one version is added to each modified port's versions file.

Usage test pass with following triplets:

```
x64-windows
```
Compile test pass with following triplets:
```
x64-windows
x64-linux
```
  • Loading branch information
jimwang118 committed May 13, 2024
1 parent 9e1b320 commit f4456c1
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 3 deletions.
94 changes: 94 additions & 0 deletions ports/libodb/fix-linux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
diff --git a/odb/details/shared-ptr/base.cxx b/odb/details/shared-ptr/base.cxx
index b95797b..6cf8ed7 100644
--- a/odb/details/shared-ptr/base.cxx
+++ b/odb/details/shared-ptr/base.cxx
@@ -54,7 +54,7 @@ namespace odb
}

void*
-operator new (size_t n, odb::details::share s) throw (std::bad_alloc)
+operator new (size_t n, odb::details::share s)
{
if (s == odb::details::shared)
{
@@ -74,7 +74,7 @@ operator new (size_t n, odb::details::share s) throw (std::bad_alloc)
}

void
-operator delete (void* p, odb::details::share s) throw ()
+operator delete (void* p, odb::details::share s)
{
// This version of operator delete is only called when the c-tor
// fails. In this case there is no object and we can just free the
diff --git a/odb/details/shared-ptr/base.hxx b/odb/details/shared-ptr/base.hxx
index 4a38945..1c951a8 100644
--- a/odb/details/shared-ptr/base.hxx
+++ b/odb/details/shared-ptr/base.hxx
@@ -35,10 +35,10 @@ namespace odb
}

LIBODB_EXPORT void*
-operator new (std::size_t, odb::details::share) throw (std::bad_alloc);
+operator new (std::size_t, odb::details::share);

LIBODB_EXPORT void
-operator delete (void*, odb::details::share) throw ();
+operator delete (void*, odb::details::share);

namespace odb
{
@@ -62,16 +62,16 @@ namespace odb
_ref_count () const;

void*
- operator new (std::size_t) throw (std::bad_alloc);
+ operator new (std::size_t);

void*
- operator new (std::size_t, share) throw (std::bad_alloc);
+ operator new (std::size_t, share);

void
- operator delete (void*, share) throw ();
+ operator delete (void*, share);

void
- operator delete (void*) throw ();
+ operator delete (void*);

struct refcount_callback
{
diff --git a/odb/details/shared-ptr/base.ixx b/odb/details/shared-ptr/base.ixx
index 9bf7c94..e03ea86 100644
--- a/odb/details/shared-ptr/base.ixx
+++ b/odb/details/shared-ptr/base.ixx
@@ -64,25 +64,25 @@ namespace odb
}

inline void* shared_base::
- operator new (std::size_t n) throw (std::bad_alloc)
+ operator new (std::size_t n)
{
return ::operator new (n);
}

inline void* shared_base::
- operator new (std::size_t n, share) throw (std::bad_alloc)
+ operator new (std::size_t n, share)
{
return ::operator new (n);
}

inline void shared_base::
- operator delete (void* p, share) throw ()
+ operator delete (void* p, share)
{
::operator delete (p);
}

inline void shared_base::
- operator delete (void* p) throw ()
+ operator delete (void* p)
{
::operator delete (p);
}
2 changes: 2 additions & 0 deletions ports/libodb/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
fix-linux.patch
)
file(REMOVE "${SOURCE_PATH}/version")

Expand Down
2 changes: 1 addition & 1 deletion ports/libodb/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libodb",
"version": "2.4.0",
"port-version": 10,
"port-version": 11,
"description": "ODB library, base runtime for the ODB ORM solution",
"homepage": "https://www.codesynthesis.com/products/odb/",
"dependencies": [
Expand Down
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ libmpeg2:arm-neon-android=fail
libmpeg2:arm64-android=fail
libmpeg2:x64-android=fail
libmysql:x86-windows=skip
libodb:x64-linux=fail # dynamic exception specifications
libopensp:arm-neon-android=fail
libopensp:arm64-android=fail
libopensp:x64-android=fail
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4730,7 +4730,7 @@
},
"libodb": {
"baseline": "2.4.0",
"port-version": 10
"port-version": 11
},
"libodb-boost": {
"baseline": "2.4.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libodb.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "daca6d80b91b4d1c0d94a3b8a5553e6c2e9aa64f",
"version": "2.4.0",
"port-version": 11
},
{
"git-tree": "e7f1f5aa4bec08ddcadab7f1f7512234b8c44155",
"version": "2.4.0",
Expand Down

0 comments on commit f4456c1

Please sign in to comment.