Skip to content

Commit 0a5fd12

Browse files
committed
PHPC-1118: Implement use of clang-format
1 parent 5470e28 commit 0a5fd12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3225
-3018
lines changed

.clang-format

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Mozilla
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlinesLeft: true
9+
AlignOperands: false
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterClass: true
25+
AfterControlStatement: false
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Linux
37+
BreakBeforeTernaryOperators: false
38+
BreakConstructorInitializersBeforeComma: true
39+
ColumnLimit: 0
40+
CommentPragmas: '^ IWYU pragma:'
41+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
42+
ConstructorInitializerIndentWidth: 4
43+
ContinuationIndentWidth: 4
44+
Cpp11BracedListStyle: false
45+
DerivePointerAlignment: false
46+
DisableFormat: false
47+
ExperimentalAutoDetectBinPacking: false
48+
ForEachMacros: []
49+
IncludeBlocks: Preserve
50+
IncludeCategories:
51+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
52+
Priority: 2
53+
- Regex: '^(<|"(gtest|isl|json)/)'
54+
Priority: 3
55+
- Regex: '.*'
56+
Priority: 1
57+
IndentCaseLabels: true
58+
IndentPPDirectives: None
59+
IndentWidth: 4
60+
IndentWrappedFunctionNames: false
61+
KeepEmptyLinesAtTheStartOfBlocks: true
62+
MacroBlockBegin: '^(ZEND_BEGIN_ARG_INFO_EX)|(PHP_INI_BEGIN)|(ZEND_BEGIN_MODULE_GLOBALS)'
63+
MacroBlockEnd: '^(ZEND_END_ARG_INFO)|(PHP_INI_END)|(ZEND_END_MODULE_GLOBALS)'
64+
MaxEmptyLinesToKeep: 1
65+
NamespaceIndentation: None
66+
ObjCBlockIndentWidth: 2
67+
ObjCSpaceAfterProperty: true
68+
ObjCSpaceBeforeProtocolList: false
69+
PenaltyBreakBeforeFirstCallParameter: 1
70+
PenaltyBreakComment: 300
71+
PenaltyBreakFirstLessLess: 120
72+
PenaltyBreakString: 1000
73+
PenaltyExcessCharacter: 0
74+
PenaltyReturnTypeOnItsOwnLine: 20000
75+
PointerAlignment: Left
76+
ReflowComments: false
77+
SortIncludes: false
78+
SpaceAfterCStyleCast: true
79+
SpaceBeforeAssignmentOperators: true
80+
SpaceBeforeParens: ControlStatements
81+
SpaceInEmptyParentheses: false
82+
SpacesBeforeTrailingComments: 1
83+
SpacesInAngles: false
84+
SpacesInContainerLiterals: false
85+
SpacesInCStyleCastParentheses: false
86+
SpacesInParentheses: false
87+
SpacesInSquareBrackets: false
88+
Standard: Cpp11
89+
TabWidth: 4
90+
UseTab: ForContinuationAndIndentation
91+
...
92+

Makefile.frag

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: coverage test-clean package package.xml
1+
.PHONY: coverage test-clean package package.xml format format-changed
22

33
DATE=`date +%Y-%m-%d--%H-%M-%S`
44
MONGODB_VERSION=$(shell php -n -dextension=modules/mongodb.so -r 'echo MONGODB_VERSION;')
@@ -64,6 +64,12 @@ test-bootstrap:
6464
vagrant ssh mo -c 'sudo mongo-orchestration -f mongo-orchestration-config.json -b 192.168.112.10 --enable-majority-read-concern start'
6565
php scripts/start-servers.php
6666

67+
format:
68+
$(top_srcdir)/scripts/clang-format.sh
69+
70+
format-changed:
71+
$(top_srcdir)/scripts/clang-format.sh changed
72+
6773
distcheck: package test-virtual
6874

6975
test-virtual: package

phongo_compat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
/* Our Compatability header */
1818
#include "phongo_compat.h"
1919

20-
void phongo_add_exception_prop(const char *prop, int prop_len, zval *value TSRMLS_DC)
20+
void phongo_add_exception_prop(const char* prop, int prop_len, zval* value TSRMLS_DC)
2121
{
2222
if (EG(exception)) {
2323
#if PHP_VERSION_ID >= 70000
2424
zval ex;
2525
EXCEPTION_P(EG(exception), ex);
2626
zend_update_property(Z_OBJCE(ex), &ex, prop, prop_len, value);
2727
#else
28-
zval *ex = NULL;
28+
zval* ex = NULL;
2929
EXCEPTION_P(EG(exception), ex);
3030
zend_update_property(Z_OBJCE_P(ex), ex, prop, prop_len, value TSRMLS_CC);
3131
#endif

0 commit comments

Comments
 (0)