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
Change .clang-format to apply linebreaks before open-braces #1423
base: master
Are you sure you want to change the base?
Conversation
AfterExternBlock: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false |
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.
This setting is to control whether the brace itself follows indentation, which i don't think anyone wants.
@@ -80,10 +80,11 @@ IncludeCategories: | |||
IncludeIsMainRegex: '(Test)?$' | |||
IncludeIsMainSourceRegex: '' | |||
IndentCaseLabels: false | |||
IndentGotoLabels: true | |||
IndentGotoLabels: false |
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.
goto labels are important to be able to quickly identify. Having them left-aligned in the text helps provide that visual indication.
IndentPPDirectives: None | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
IndentExternBlock: false |
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.
Many headers are wrapped with extern "C"
blocks, don't indent the code found inside those.
extern int LLVMFuzzerTestOneInput(const uint8_t *Data, | ||
size_t Size) { // rfc5769check | ||
extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) | ||
{ // rfc5769check |
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.
An example of parameters previously on two lines being able to be on one line. Helps with readability of the function.
@@ -976,22 +1166,28 @@ | |||
* \param pnOutSize: size of char string | |||
* \return | |||
*/ | |||
wchar_t *_ATW(__in char *pszInBuf, __in int nInSize, __out wchar_t **pszOutBuf, __out int *pnOutSize) { | |||
if (!pszInBuf || !pszOutBuf || !pnOutSize || nInSize <= 0) { | |||
wchar_t *_ATW(__in char *pszInBuf, __in int nInSize, __out wchar_t **pszOutBuf, __out int *pnOutSize) |
Check warning
Code scanning / PREfast
Returning uninitialized memory '*pszOutBuf'. A successful path through the function does not set the named Out parameter. Warning
@@ -976,22 +1166,28 @@ | |||
* \param pnOutSize: size of char string | |||
* \return | |||
*/ | |||
wchar_t *_ATW(__in char *pszInBuf, __in int nInSize, __out wchar_t **pszOutBuf, __out int *pnOutSize) { | |||
if (!pszInBuf || !pszOutBuf || !pnOutSize || nInSize <= 0) { | |||
wchar_t *_ATW(__in char *pszInBuf, __in int nInSize, __out wchar_t **pszOutBuf, __out int *pnOutSize) |
Check warning
Code scanning / PREfast
Returning uninitialized memory '*pnOutSize'. A successful path through the function does not set the named Out parameter. Warning
@@ -1005,21 +1201,27 @@ | |||
* \param pnOutSize: size of wchar string | |||
* \return | |||
*/ | |||
char *_WTA(__in wchar_t *pszInBuf, __in int nInSize, __out char **pszOutBuf, __out int *pnOutSize) { | |||
if (!pszInBuf || !pszOutBuf || !pnOutSize || nInSize <= 0) { | |||
char *_WTA(__in wchar_t *pszInBuf, __in int nInSize, __out char **pszOutBuf, __out int *pnOutSize) |
Check warning
Code scanning / PREfast
Returning uninitialized memory '*pszOutBuf'. A successful path through the function does not set the named Out parameter. Warning
@@ -1005,21 +1201,27 @@ | |||
* \param pnOutSize: size of wchar string | |||
* \return | |||
*/ | |||
char *_WTA(__in wchar_t *pszInBuf, __in int nInSize, __out char **pszOutBuf, __out int *pnOutSize) { | |||
if (!pszInBuf || !pszOutBuf || !pnOutSize || nInSize <= 0) { | |||
char *_WTA(__in wchar_t *pszInBuf, __in int nInSize, __out char **pszOutBuf, __out int *pnOutSize) |
Check warning
Code scanning / PREfast
Returning uninitialized memory '*pnOutSize'. A successful path through the function does not set the named Out parameter. Warning
strncpy(fn + fnlen, config_file, fnsz - fnlen); | ||
} | ||
} | ||
} | ||
fn[fnsz] = 0; | ||
if (strstr(fn, "//") != fn) { | ||
if (strstr(fn, "//") != fn) |
Check warning
Code scanning / PREfast
'fn' could be '0': this does not adhere to the specification for the function 'strstr'. See line 1394 for an earlier location where this can occur Warning
@@ -34,9 +34,11 @@ | |||
|
|||
/////////////// io handlers /////////////////// | |||
|
|||
static void udp_server_input_handler(evutil_socket_t fd, short what, void *arg) { | |||
static void udp_server_input_handler(evutil_socket_t fd, short what, void *arg) |
Check warning
Code scanning / PREfast
Function uses '65592' bytes of stack. Consider moving some data to heap. Warning
a243d40
to
8009ead
Compare
8009ead
to
60616fc
Compare
This pull request changes the .clang-format file so that a newline is inserted before opening braces in the code.
This changes, for example
to
This has multiple benefits.