[compiler-rt] [win/asan] Ensure errno gets set correctly for strtol (PR #109258)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 02:20:06 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 30d7dcc1db476b828d3b0a7b5c9bcfbe5bd5f216 2a8678496ee5029b2d687e069f6b9c0892c794a1 --extensions cpp,h,c -- compiler-rt/lib/asan/asan_interceptors.cpp compiler-rt/lib/asan/asan_win_static_runtime_thunk.cpp compiler-rt/lib/asan/tests/asan_str_test.cpp compiler-rt/lib/sanitizer_common/sanitizer_errno.cpp compiler-rt/lib/sanitizer_common/sanitizer_errno_codes.h compiler-rt/test/asan/TestCases/strtol_strict.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index afde42e677..9531f96c84 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -652,7 +652,7 @@ static ALWAYS_INLINE auto StrtolImpl(void *ctx, Fn real, const char *nptr,
 
 INTERCEPTOR_STRTO_BASE(long long, strtoll)
 
-#if SANITIZER_WINDOWS
+#  if SANITIZER_WINDOWS
 INTERCEPTOR(long, strtol, const char *nptr, char **endptr, int base) {
   // REAL(strol) may be ntdll!strol, which doesn't set errno. Instead,
   // call REAL(strtoll) and do the range check ourselves.
@@ -674,9 +674,9 @@ INTERCEPTOR(long, strtol, const char *nptr, char **endptr, int base) {
   }
   return (long)result;
 }
-#else
+#  else
 INTERCEPTOR_STRTO_BASE(long, strtol)
-#endif
+#  endif
 
 #  if SANITIZER_GLIBC
 INTERCEPTOR_STRTO_BASE(long, __isoc23_strtol)

``````````

</details>


https://github.com/llvm/llvm-project/pull/109258


More information about the llvm-commits mailing list