lg2: add experimental::source_location symbols on GCC

When we compile with a compiler that supports the C++20 source_location,
we use that support and do not support the older experimental version.
Recent versions of GCC support it but Clang does not.  This exposes an
issue when attempting to link a GCC-compiled lg2 with a Clang-compiled
application (missing symbol for experimental version).

Add a no-op symbol for experimental::source_location when the compiler
supports std::source_location.  This allows the Clang-compiled
applications to successfully compile and link, but they will lose out on
the lg2 functionality.  The primary use-case of this is to compile with
Clang in CI in order to get signal on the stricter warnings that Clang
often has, so functionality is not necessary.

Tested:

Built with GCC and confirmed additional symbol for
experimental::source_location support.

```
$ nm lib/libphosphor_logging.so.1.0.0 --defined-only -C | grep lg2::details::do_log
0000000000004520 T lg2::details::do_log(lg2::level, std::experimental::fundamentals_v2::source_location const&, char const*, ...)
0000000000004aa0 T lg2::details::do_log(lg2::level, std::source_location const&, char const*, ...)
0000000000003682 t lg2::details::do_log(lg2::level, std::source_location const&, char const*, ...) [clone .cold]
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I4bc0b9f6619ce6088dfa44a3c18eb28d9080fb47
diff --git a/lib/lg2_logger.cpp b/lib/lg2_logger.cpp
index 8d9c034..3276499 100644
--- a/lib/lg2_logger.cpp
+++ b/lib/lg2_logger.cpp
@@ -11,6 +11,17 @@
 #include <phosphor-logging/lg2.hpp>
 #include <vector>
 
+// Clang doesn't currently support source_location, but in order to provide
+// support for compiling an application with Clang while lg2 was compiled with
+// GCC we need to provide compile support *both* source_location and
+// experimental::source_location.
+//
+// Note: The experimental::source_location code will turn into a no-op for
+//       simplicity.  This is simply to allow compilation.
+#if __has_builtin(__builtin_source_location)
+#include <experimental/source_location>
+#endif
+
 namespace lg2::details
 {
 /** Convert unsigned to string using format flags. */
@@ -290,4 +301,15 @@
     extra_output_method(l, s, message);
 }
 
+// If std::source_location is supported, provide an additional
+// std::experimental::source_location implementation that does nothing so that
+// lg2 users can compile with Clang even if lg2 was compiled with GCC.  This
+// is a no-op implementation that simply allows compile support since some
+// people like to compile with Clang for additional / stricter checks.
+#if __has_builtin(__builtin_source_location)
+void do_log(level, const std::experimental::source_location&, const char*, ...)
+{
+}
+#endif
+
 } // namespace lg2::details