[Webkit-unassigned] [Bug 247314] Code style does not match comments given in review related to newlines and preprocessor conditionals

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 1 05:30:42 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=247314

--- Comment #2 from Kimmo Kinnunen <kkinnunen at apple.com> ---
One review example in https://github.com/WebKit/WebKit/pull/5952 but possibly there are others.

Ryosuke, would you have a rule suggestion or requirement?

I'm interpreting your rule something like:

[](#linebreaking-mandatory-new-line) A new line should follow each of the lines containing following source elements:
 * End of the initial license block comment
 * After last consecutive preprocessor statement in preprocessor conditionals `#if`, `#else`, `#elif` and `#endif` 
 * After last non-preprocessor statement before above mentioned preprocessor statements
 * Last line of `.h`, `.cpp`, `.js`, `.html` and `.css` files



Example:
---
#if ENABLE(IPC_TESTING_API)

namespace WebKit {
  // ...
}

#endif

namespace WTF {
  // ..
}

--- 


Example (Connection.h):
--
#if USE(UNIX_DOMAIN_SOCKETS)
#include <wtf/unix/UnixFileDescriptor.h>
#endif

#if OS(DARWIN)
#include <mach/mach_port.h>
#include <wtf/MachSendRight.h>
#include <wtf/OSObjectPtr.h>
#include <wtf/spi/darwin/XPCSPI.h>
#endif

#if OS(WINDOWS)
#include <wtf/win/Win32Handle.h>
#endif

#if USE(GLIB)
#include <wtf/glib/GSocketMonitor.h>
#endif

#if ENABLE(IPC_TESTING_API)
#include "MessageObserver.h"
#endif

---


Example wrong in current Connection.h:
---
#if USE(UNIX_DOMAIN_SOCKETS)
    using Handle = UnixFileDescriptor;
#elif OS(WINDOWS)
    using Handle = Win32Handle;
#elif OS(DARWIN)
    using Handle = MachSendRight;
#endif
--


Example current Connection.h should be:
--
#if USE(UNIX_DOMAIN_SOCKETS)

    using Handle = UnixFileDescriptor;

#elif OS(WINDOWS)

    using Handle = Win32Handle;

#elif OS(DARWIN)

    using Handle = MachSendRight;

#endif
--




Or is the comment more of just the first file-global ifdef that comments out the code?
Something like:

[](#linebreaking-mandatory-new-line) A new line should follow each of the lines containing following source elements:
 * End of the initial license block comment
 * After last preprocessor statement in preprocessor conditionals `#if`, `#else`, `#elif` and `#endif`  that begins the enablement of conditionally compiled code in .cpp
 * After last non-preprocessor statement before above mentioned preprocessor statements

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221101/e2cc6edc/attachment.htm>


More information about the webkit-unassigned mailing list