This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 206e0e30 fix: remove deprecated operator"" syntax usage (#661)
206e0e30 is described below

commit 206e0e304c383985b17ca16399e20cf1d91c6c76
Author: David Li <[email protected]>
AuthorDate: Tue Oct 15 23:49:52 2024 +0900

    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 b9470bec..138a4ac1 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<int64_t>(size_bytes)};
 }
+#else
+inline ArrowStringView operator""_asv(const char* data, std::size_t 
size_bytes) {
+  return {data, static_cast<int64_t>(size_bytes)};
+}
+#endif
+// N.B. older GCC requires the space above, newer Clang forbids the space
 
 // @}
 

Reply via email to