File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414#include < source_location>
1515#endif
1616
17+ #if __has_include(<format>)
18+ #include < format>
19+ #endif
20+
1721#include < ISO_Fortran_binding.h>
1822
1923
24+ void check_cfi (int
25+ #if defined(__cpp_lib_source_location)
26+ , const std::source_location& = std::source_location::current()
27+ #endif
28+ );
29+
2030
2131static const std::vector<std::string> cfi_errstrs = {
2232 " No error detected." ,
@@ -54,16 +64,22 @@ std::string cfiGetErrorString(int stat) {
5464 return cfi_errstrs[11 ];
5565}
5666
57- void check_cfi (int s)
58- {
59- if (s != CFI_SUCCESS ){
67+ void check_cfi (int src
6068#if defined(__cpp_lib_source_location)
61- constexpr std::source_location loc = std::source_location::current ();
62- std::cerr << loc.file_name () << " :" << loc.line () <<
69+ , const std::source_location& location){
70+ std::string s =
71+ #if defined(__cpp_lib_format)
72+ std::format (" {}:{}" , location.file_name (), location.line ());
73+ #else
74+ std::string (location.file_name ()) + " :" + std::to_string (location.line ());
75+ #endif
6376#else
64- std::cerr <<
77+ ){
78+ std::string_view s;
6579#endif
66- " CFI API failed with error: (" << s << " ) " << cfiGetErrorString (s) << " \n " ;
80+
81+ if (src != CFI_SUCCESS ){
82+ std::cerr <<" CFI API failed " << s << " with error: (" << src << " ) " << cfiGetErrorString (src) << " \n " ;
6783 }
6884}
6985
You can’t perform that action at this time.
0 commit comments