summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-10-03 11:30:34 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-12 20:59:45 +0200
commit9c5f597fc80a8a910c1f898556ef2a3226dfe40c (patch)
treee3765086a4f83a99a21430f67e41b9a39daa113d /codemaker
parent6afffcee5fcf7c9719abe7176468d20602e750bf (diff)
use std::source_location instead of std::experimental::source_location
https://en.cppreference.com/w/cpp/compiler_support says that this is supported in GCC >= 11 CLANG >= 16 Visual Studio >= VS 2019 16.10 And our Visual Studio baseline is now 2019. We still need to make the ifdef conditional check clang, because __has_include will happily return true even if the current clang does not support the necessary builtins. Change-Id: I5f2743e204b8ed22d4651053f3ae579a4a192a45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157515 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 47b3d8f488a5..235e55017610 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -3013,13 +3013,16 @@ void ExceptionType::dumpHdlFile(
{
if (name_ == "com.sun.star.uno.Exception")
{
- // LIBO_INTERNAL_ONLY implies GCC >= 7, which we need for this
- // libstdc++ header.
- includes.addCustom("#if defined LIBO_INTERNAL_ONLY && (defined __GNUC__ || defined __clang__) && __has_include(<experimental/source_location>)");
- includes.addCustom("#define LIBO_USE_SOURCE_LOCATION");
+ includes.addCustom("#if defined(LIBO_INTERNAL_ONLY)");
+ includes.addCustom("#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907");
+ includes.addCustom("#include <source_location>");
+ includes.addCustom("#define LIBO_USE_SOURCE_LOCATION std");
+ includes.addCustom("#elif __has_include(<experimental/source_location>)");
+ includes.addCustom("#include <experimental/source_location>");
+ includes.addCustom("#define LIBO_USE_SOURCE_LOCATION std::experimental");
+ includes.addCustom("#endif");
includes.addCustom("#endif");
includes.addCustom("#if defined LIBO_USE_SOURCE_LOCATION");
- includes.addCustom("#include <experimental/source_location>");
includes.addCustom("#include <o3tl/runtimetooustring.hxx>");
includes.addCustom("#endif");
}
@@ -3059,7 +3062,7 @@ void ExceptionType::dumpHppFile(
// default constructor
out << "\ninline " << id_ << "::" << id_ << "(\n";
out << "#if defined LIBO_USE_SOURCE_LOCATION\n";
- out << " std::experimental::source_location location\n";
+ out << " LIBO_USE_SOURCE_LOCATION::source_location location\n";
out << "#endif\n";
out << " )\n";
inc();
@@ -3114,7 +3117,7 @@ void ExceptionType::dumpHppFile(
bFirst = false;
}
out << "\n#if defined LIBO_USE_SOURCE_LOCATION\n";
- out << " " << (bFirst ? "" : ", ") << "std::experimental::source_location location\n";
+ out << " " << (bFirst ? "" : ", ") << "LIBO_USE_SOURCE_LOCATION::source_location location\n";
out << "#endif\n";
out << ")\n";
inc();
@@ -3375,7 +3378,7 @@ void ExceptionType::dumpDeclaration(FileStream & out)
// default constructor
out << indent() << "inline CPPU_GCC_DLLPRIVATE " << id_ << "(\n";
out << "#if defined LIBO_USE_SOURCE_LOCATION\n";
- out << " std::experimental::source_location location = std::experimental::source_location::current()\n";
+ out << " LIBO_USE_SOURCE_LOCATION::source_location location = LIBO_USE_SOURCE_LOCATION::source_location::current()\n";
out << "#endif\n\n";
out << " );\n";
@@ -3393,7 +3396,7 @@ void ExceptionType::dumpDeclaration(FileStream & out)
bFirst = false;
}
out << "\n#if defined LIBO_USE_SOURCE_LOCATION\n";
- out << ", std::experimental::source_location location = std::experimental::source_location::current()\n";
+ out << ", LIBO_USE_SOURCE_LOCATION::source_location location = LIBO_USE_SOURCE_LOCATION::source_location::current()\n";
out << "#endif\n";
out << " );\n\n";
}