Ubuntu 23-04 (Lunar) has g++ v13.0.1 (in the universe section,
this is not the default g++ compiler).
At least as curently shipped, this warns about the line
        [[clang::fallthrough]];
(partly becuase with the default settings
        [[fallthrough]];
is now needed to silence warnings where a fallthrough *is* intended).

Based on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109653#c3
I have attached a patch for ports/cpl_port.h

--
Andrew C. Aitchison                      Kendal, UK
                   and...@aitchison.me.uk
diff --git a/port/cpl_port.h b/port/cpl_port.h
index 41fd67bc0a..7bba9ab3c7 100644
--- a/port/cpl_port.h
+++ b/port/cpl_port.h
@@ -1129,6 +1129,15 @@ extern "C++"
 #define HAVE_GCC_SYSTEM_HEADER
 #endif
 
+#if defined __has_cpp_attribute
+#  if __has_cpp_attribute (clang::fallthrough)
+#   define CPL_FALLTHROUGH [[clang::fallthrough]]
+#  elif __has_cpp_attribute (gnu::fallthrough)
+#   define CPL_FALLTHROUGH [[gnu::fallthrough]]
+#  elif  __has_cpp_attribute (fallthrough)
+#   define CPL_FALLTHROUGH [[fallthrough]]
+# endif
+#else
 #if ((defined(__clang__) &&                                                \
       (__clang_major__ > 3 ||                                              \
        (__clang_major__ == 3 && __clang_minor__ >= 7))) ||                 \
@@ -1139,6 +1148,7 @@ extern "C++"
 /** Macro for fallthrough in a switch case construct */
 #define CPL_FALLTHROUGH
 #endif
+#endif
 
 /*! @cond Doxygen_Suppress */
 
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to