[clang] [compiler-rt] [safestack] Various Solaris fixes (PR #98001)

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 01:48:39 PDT 2024


rorth wrote:

> ⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️
> You can test this locally with the following command:
> View the diff from clang-format here.
> 
> ```diff
> diff --git a/compiler-rt/lib/safestack/safestack_platform.h b/compiler-rt/lib/safestack/safestack_platform.h
> index 77eeb9cda6..27e29d6ead 100644
> --- a/compiler-rt/lib/safestack/safestack_platform.h
> +++ b/compiler-rt/lib/safestack/safestack_platform.h
> @@ -13,9 +13,6 @@
>  #ifndef SAFESTACK_PLATFORM_H
>  #define SAFESTACK_PLATFORM_H
>  
> -#include "safestack_util.h"
> -#include "sanitizer_common/sanitizer_platform.h"
> -
>  #include <dlfcn.h>
>  #include <errno.h>
>  #include <stdint.h>
> @@ -26,6 +23,9 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>  
> +#include "safestack_util.h"
> +#include "sanitizer_common/sanitizer_platform.h"
> +
>  #if !(SANITIZER_NETBSD || SANITIZER_FREEBSD || SANITIZER_LINUX || \
>        SANITIZER_SOLARIS)
>  #  error "Support for your platform has not been implemented"
> ```

I had seen that when running `clang-format-diff.py`, but chose to ignore that because it seems unrelated and even somewhat dangerous: there are often cases where you need to define some macro **before** including system headers.

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


More information about the cfe-commits mailing list