diff --git a/src/c4/error.cpp b/src/c4/error.cpp index 845b1e7b..2ddc5f99 100644 --- a/src/c4/error.cpp +++ b/src/c4/error.cpp @@ -151,33 +151,38 @@ bool is_debugger_attached() if(first_call) { first_call = false; + C4_SUPPRESS_WARNING_GCC_PUSH + #if defined(__GNUC__) && __GNUC__ > 9 + C4_SUPPRESS_WARNING_GCC("-Wanalyzer-fd-leak") + #endif //! @see http://stackoverflow.com/questions/3596781/how-to-detect-if-the-current-process-is-being-run-by-gdb //! (this answer: http://stackoverflow.com/a/24969863/3968589 ) char buf[1024] = ""; - int status_fd = open("/proc/self/status", O_RDONLY); if (status_fd == -1) { return 0; } - - ssize_t num_read = ::read(status_fd, buf, sizeof(buf)); - - if (num_read > 0) + else { - static const char TracerPid[] = "TracerPid:"; - char *tracer_pid; - - if(num_read < 1024) - { - buf[num_read] = 0; - } - tracer_pid = strstr(buf, TracerPid); - if (tracer_pid) + ssize_t num_read = ::read(status_fd, buf, sizeof(buf)); + if (num_read > 0) { - first_call_result = !!::atoi(tracer_pid + sizeof(TracerPid) - 1); + static const char TracerPid[] = "TracerPid:"; + char *tracer_pid; + if(num_read < 1024) + { + buf[num_read] = 0; + } + tracer_pid = strstr(buf, TracerPid); + if (tracer_pid) + { + first_call_result = !!::atoi(tracer_pid + sizeof(TracerPid) - 1); + } } + close(status_fd); } + C4_SUPPRESS_WARNING_GCC_POP } return first_call_result; #elif defined(C4_PS4) diff --git a/src/c4/format.cpp b/src/c4/format.cpp index e42a99d3..fb5707a7 100644 --- a/src/c4/format.cpp +++ b/src/c4/format.cpp @@ -45,8 +45,12 @@ bool from_chars(csubstr buf, fmt::raw_wrapper *r) auto ptr = (decltype(buf.str)) std::align(r->alignment, r->len, vptr, space); C4_CHECK(ptr != nullptr); C4_CHECK(ptr >= buf.begin() && ptr <= buf.end()); - //size_t dim = (ptr - buf.str) + r->len; + C4_SUPPRESS_WARNING_GCC_PUSH + #if defined(__GNUC__) && __GNUC__ > 9 + C4_SUPPRESS_WARNING_GCC("-Wanalyzer-null-argument") + #endif memcpy(r->buf, ptr, r->len); + C4_SUPPRESS_WARNING_GCC_POP return true; } diff --git a/test/test_charconv.cpp b/test/test_charconv.cpp index 0a56a566..0d62f3b0 100644 --- a/test/test_charconv.cpp +++ b/test/test_charconv.cpp @@ -15,7 +15,7 @@ C4_SUPPRESS_WARNING_GCC("-Wuseless-cast") C4_SUPPRESS_WARNING_GCC("-Wconversion") C4_SUPPRESS_WARNING_GCC("-Wtype-limits") C4_SUPPRESS_WARNING_GCC("-Wfloat-equal") -#if defined (__GNUC__) && __GNUC_MAJOR__ >= 7 +#if defined (__GNUC__) && __GNUC__ >= 9 C4_SUPPRESS_WARNING_GCC("-Wno-noexcept-type") #endif C4_SUPPRESS_WARNING_CLANG_PUSH