-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[C++] Indent preprocessor directives #43796
Copy link
Copy link
Closed
Description
Describe the enhancement requested
We don't indent in preprocessor directives now. For example:
arrow/cpp/src/arrow/util/visibility.h
Lines 20 to 27 in bad064f
| #if defined(_WIN32) || defined(__CYGWIN__) | |
| // Windows | |
| #if defined(_MSC_VER) | |
| #pragma warning(disable : 4251) | |
| #else | |
| #pragma GCC diagnostic ignored "-Wattributes" | |
| #endif |
If we indent preprocessor directives, it improves readability:
#if defined(_WIN32) || defined(__CYGWIN__)
// Windows
# if defined(_MSC_VER)
# pragma warning(disable : 4251)
# else
# pragma GCC diagnostic ignored "-Wattributes"
# endifFYI: Google C++ style guide doesn't require indent in preprocessor directives nor deny it:
https://google.github.io/styleguide/cppguide.html#Preprocessor_Directives
// Good - directives at beginning of line
if (lopsided_score) {
#if DISASTER_PENDING // Correct -- Starts at beginning of line
DropEverything();
# if NOTIFY // OK but not required -- Spaces after #
NotifyClient();
# endif
#endif
BackToNormal();
}Component(s)
C++
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Fields
Give feedbackNo fields configured for issues without a type.