-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[libunwind] Use consistent indentation in __libunwind_config.h
#152861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-libunwind Author: Michał Górny (mgorny) ChangesUse consistent indentation patterns all across Full diff: https://github.com/llvm/llvm-project/pull/152861.diff 1 Files Affected:
diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h
index bb7fe4c83a3c1..bf29132a8ebc4 100644
--- a/libunwind/include/__libunwind_config.h
+++ b/libunwind/include/__libunwind_config.h
@@ -136,17 +136,16 @@
# error "Unsupported MIPS ABI and/or environment"
# endif
# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS
-#elif defined(__sparc__) && defined(__arch64__)
-#define _LIBUNWIND_TARGET_SPARC64 1
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER \
- _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64
-#define _LIBUNWIND_CONTEXT_SIZE 33
-#define _LIBUNWIND_CURSOR_SIZE 45
+# elif defined(__sparc__) && defined(__arch64__)
+# define _LIBUNWIND_TARGET_SPARC64 1
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64
+# define _LIBUNWIND_CONTEXT_SIZE 33
+# define _LIBUNWIND_CURSOR_SIZE 45
# elif defined(__sparc__)
- #define _LIBUNWIND_TARGET_SPARC 1
- #define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC
- #define _LIBUNWIND_CONTEXT_SIZE 16
- #define _LIBUNWIND_CURSOR_SIZE 23
+# define _LIBUNWIND_TARGET_SPARC 1
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC
+# define _LIBUNWIND_CONTEXT_SIZE 16
+# define _LIBUNWIND_CURSOR_SIZE 23
# elif defined(__riscv)
# define _LIBUNWIND_TARGET_RISCV 1
# if defined(__riscv_flen)
@@ -162,7 +161,7 @@
# else
# error "Unsupported RISC-V ABI"
# endif
-# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV
# elif defined(__ve__)
# define _LIBUNWIND_TARGET_VE 1
# define _LIBUNWIND_CONTEXT_SIZE 67
@@ -173,20 +172,19 @@
# define _LIBUNWIND_CONTEXT_SIZE 34
# define _LIBUNWIND_CURSOR_SIZE 46
# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_S390X
-#elif defined(__loongarch__)
-#define _LIBUNWIND_TARGET_LOONGARCH 1
-#if __loongarch_grlen == 64
-#define _LIBUNWIND_CONTEXT_SIZE 65
-#define _LIBUNWIND_CURSOR_SIZE 77
-#else
-#error "Unsupported LoongArch ABI"
-#endif
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER \
- _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH
-#elif defined(__wasm__)
+# elif defined(__loongarch__)
+# define _LIBUNWIND_TARGET_LOONGARCH 1
+# if __loongarch_grlen == 64
+# define _LIBUNWIND_CONTEXT_SIZE 65
+# define _LIBUNWIND_CURSOR_SIZE 77
+# else
+# error "Unsupported LoongArch ABI"
+# endif
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH
+# elif defined(__wasm__)
// Unused
-#define _LIBUNWIND_CONTEXT_SIZE 0
-#define _LIBUNWIND_CURSOR_SIZE 0
+# define _LIBUNWIND_CONTEXT_SIZE 0
+# define _LIBUNWIND_CURSOR_SIZE 0
# else
# error "Unsupported architecture."
# endif
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Use consistent indentation patterns all across `__libunwind_config.h`. The huge number of branches of the preprocessor conditions make them really unreadable when some of them are not indented. Signed-off-by: Michał Górny <[email protected]>
6eecf8b
to
f4c0717
Compare
// Disable clang-format as it makes the huge conditions unreadable. | ||
// clang-format off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the point is making indentations correct, why disable clang-format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's removing all indentation completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I thought this fixed incorrect indentations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just flattens everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, clang-format
flattens everything, so I'm disabling it, so indentations remain meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe just set IndentPPDirectives: AfterHash
? We already do that in libc++, libc++abi and (I think) compiler-rt.
I suppose it would make sense to me, but I don't feel like I'm the person to make that decision. |
Ah I didn't know we needed this to support preprocessor indentation. I thought it was by default on because I've seen header indentations in other libraries. If this is the case I also think setting that would be better than disabling clang-format. I'm not a libunwind maintainer so I'm not sure if I can decide on that though. |
Use consistent indentation patterns all across
__libunwind_config.h
. The huge number of branches of the preprocessor conditions make them really unreadable when some of them are not indented.