From 206e0e304c383985b17ca16399e20cf1d91c6c76 Mon Sep 17 00:00:00 2001
From: David Li
Date: Tue, 15 Oct 2024 23:49:52 +0900
Subject: [PATCH] fix: remove deprecated operator"" syntax usage (#661)
Clang warns about this. Apparently GCC 4.9 may warn about the fixed
syntax, though!
Spotted in the ADBC CI:
```
/adbc/c/vendor/nanoarrow/nanoarrow.hpp:94:35: error: identifier '_asv' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
94 | inline ArrowStringView operator"" _asv(const char* data, std::size_t size_bytes) {
| ~~~~~~~~~~~^~~~
| operator""_asv
```
---
src/nanoarrow/nanoarrow.hpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/nanoarrow/nanoarrow.hpp b/src/nanoarrow/nanoarrow.hpp
index b9470bec9..138a4ac10 100644
--- a/src/nanoarrow/nanoarrow.hpp
+++ b/src/nanoarrow/nanoarrow.hpp
@@ -92,9 +92,16 @@ namespace literals {
/// @{
/// \brief User literal operator allowing ArrowStringView construction like "str"_asv
+#if !defined(__clang__) && (defined(__GNUC__) && __GNUC__ < 6)
inline ArrowStringView operator"" _asv(const char* data, std::size_t size_bytes) {
return {data, static_cast(size_bytes)};
}
+#else
+inline ArrowStringView operator""_asv(const char* data, std::size_t size_bytes) {
+ return {data, static_cast(size_bytes)};
+}
+#endif
+// N.B. older GCC requires the space above, newer Clang forbids the space
// @}