Skip to content

Commit

Permalink
clang-format codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Jan 13, 2015
1 parent d8532af commit b5dcec5
Show file tree
Hide file tree
Showing 189 changed files with 12,456 additions and 12,667 deletions.
65 changes: 65 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 2
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...

2 changes: 1 addition & 1 deletion include/grpc++/async_server_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AsyncServerContext {
system_clock::time_point absolute_deadline_;

google::protobuf::Message* request_; // not owned
grpc_call* call_; // owned
grpc_call* call_; // owned
};

} // namespace grpc
Expand Down
8 changes: 4 additions & 4 deletions include/grpc++/channel_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class ChannelInterface {
const google::protobuf::Message& request,
google::protobuf::Message* result) = 0;

virtual StreamContextInterface* CreateStream(const RpcMethod& method,
ClientContext* context,
const google::protobuf::Message* request,
google::protobuf::Message* result) = 0;
virtual StreamContextInterface* CreateStream(
const RpcMethod& method, ClientContext* context,
const google::protobuf::Message* request,
google::protobuf::Message* result) = 0;
};

} // namespace grpc
Expand Down
1 change: 0 additions & 1 deletion include/grpc++/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
namespace grpc {

typedef std::string string;

}

#endif // __GRPCPP_CONFIG_H__
1 change: 0 additions & 1 deletion include/grpc++/credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ class CredentialsFactory {
const grpc::string& authorization_token,
const grpc::string& authority_selector);


// Combines two credentials objects into a composite credentials
static std::unique_ptr<Credentials> ComposeCredentials(
const std::unique_ptr<Credentials>& creds1,
Expand Down
16 changes: 11 additions & 5 deletions include/grpc++/impl/rpc_service_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ class MethodHandler {
public:
virtual ~MethodHandler() {}
struct HandlerParameter {
HandlerParameter(ServerContext* context, const google::protobuf::Message* req,
HandlerParameter(ServerContext* context,
const google::protobuf::Message* req,
google::protobuf::Message* resp)
: server_context(context),
request(req),
response(resp),
stream_context(nullptr) {}
HandlerParameter(ServerContext* context, const google::protobuf::Message* req,
google::protobuf::Message* resp, StreamContextInterface* stream)
HandlerParameter(ServerContext* context,
const google::protobuf::Message* req,
google::protobuf::Message* resp,
StreamContextInterface* stream)
: server_context(context),
request(req),
response(resp),
Expand Down Expand Up @@ -171,7 +174,8 @@ class RpcServiceMethod : public RpcMethod {
public:
// Takes ownership of the handler and two prototype objects.
RpcServiceMethod(const char* name, RpcMethod::RpcType type,
MethodHandler* handler, google::protobuf::Message* request_prototype,
MethodHandler* handler,
google::protobuf::Message* request_prototype,
google::protobuf::Message* response_prototype)
: RpcMethod(name, type),
handler_(handler),
Expand All @@ -180,7 +184,9 @@ class RpcServiceMethod : public RpcMethod {

MethodHandler* handler() { return handler_.get(); }

google::protobuf::Message* AllocateRequestProto() { return request_prototype_->New(); }
google::protobuf::Message* AllocateRequestProto() {
return request_prototype_->New();
}
google::protobuf::Message* AllocateResponseProto() {
return response_prototype_->New();
}
Expand Down
1 change: 0 additions & 1 deletion include/grpc++/status_code_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#ifndef __GRPCPP_STATUS_CODE_ENUM_H__
#define __GRPCPP_STATUS_CODE_ENUM_H__


namespace grpc {

enum StatusCode {
Expand Down
2 changes: 1 addition & 1 deletion include/grpc/byte_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ struct grpc_byte_buffer {
} data;
};

#endif /* __GRPC_BYTE_BUFFER_H__ */
#endif /* __GRPC_BYTE_BUFFER_H__ */
2 changes: 1 addition & 1 deletion include/grpc/byte_buffer_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader {
} current;
};

#endif /* __GRPC_BYTE_BUFFER_READER_H__ */
#endif /* __GRPC_BYTE_BUFFER_READER_H__ */
2 changes: 1 addition & 1 deletion include/grpc/grpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,4 +453,4 @@ void grpc_server_destroy(grpc_server *server);
}
#endif

#endif /* __GRPC_GRPC_H__ */
#endif /* __GRPC_GRPC_H__ */
3 changes: 1 addition & 2 deletions include/grpc/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#ifndef __GRPC_STATUS_H__
#define __GRPC_STATUS_H__


#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -200,4 +199,4 @@ typedef enum {
}
#endif

#endif /* __GRPC_STATUS_H__ */
#endif /* __GRPC_STATUS_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr);
}
#endif

#endif /* __GRPC_SUPPORT_ALLOC_H__ */
#endif /* __GRPC_SUPPORT_ALLOC_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/atm.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
#error could not determine platform for atm
#endif

#endif /* __GRPC_SUPPORT_ATM_H__ */
#endif /* __GRPC_SUPPORT_ATM_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/atm_gcc_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
__ATOMIC_RELAXED);
}

#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */
#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/atm_gcc_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) {
#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))

#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */
#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */
4 changes: 2 additions & 2 deletions include/grpc/support/atm_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) {
}

static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
/* InterlockedCompareExchangePointerNoFence() not available on vista or
windows7 */
/* InterlockedCompareExchangePointerNoFence() not available on vista or
windows7 */
#ifdef GPR_ARCH_64
return o == (gpr_atm)InterlockedCompareExchangeAcquire64(p, n, o);
#else
Expand Down
2 changes: 1 addition & 1 deletion include/grpc/support/cancellable_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ typedef struct {
struct gpr_cancellable_list_ waiters;
} gpr_cancellable;

#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */
#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl);
}
#endif

#endif /* __GRPC_SUPPORT_CMDLINE_H__ */
#endif /* __GRPC_SUPPORT_CMDLINE_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
}
#endif

#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */
#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func);
}
#endif

#endif /* __GRPC_SUPPORT_LOG_H__ */
#endif /* __GRPC_SUPPORT_LOG_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b);
}
#endif

#endif /* __GRPC_SUPPORT_SLICE_H__ */
#endif /* __GRPC_SUPPORT_SLICE_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/slice_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
}
#endif

#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */
#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ int gpr_asprintf(char **strp, const char *format, ...);
}
#endif

#endif /* __GRPC_SUPPORT_STRING_H__ */
#endif /* __GRPC_SUPPORT_STRING_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c);
}
#endif

#endif /* __GRPC_SUPPORT_SYNC_H__ */
#endif /* __GRPC_SUPPORT_SYNC_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/sync_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ typedef struct { gpr_atm value; } gpr_stats_counter;
#define GPR_STATS_INIT \
{ 0 }

#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */
#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/sync_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ typedef pthread_once_t gpr_once;

#define GPR_ONCE_INIT PTHREAD_ONCE_INIT

#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */
#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/sync_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ typedef CONDITION_VARIABLE gpr_cv;
typedef INIT_ONCE gpr_once;
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT

#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */
#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/thd.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ gpr_thd_options gpr_thd_options_default(void);
}
#endif

#endif /* __GRPC_SUPPORT_THD_H__ */
#endif /* __GRPC_SUPPORT_THD_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/thd_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

typedef pthread_t gpr_thd_id;

#endif /* __GRPC_SUPPORT_THD_POSIX_H__ */
#endif /* __GRPC_SUPPORT_THD_POSIX_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/thd_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@

typedef int gpr_thd_id;

#endif /* __GRPC_SUPPORT_THD_WIN32_H__ */
#endif /* __GRPC_SUPPORT_THD_WIN32_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ double gpr_timespec_to_micros(gpr_timespec t);
}
#endif

#endif /* __GRPC_SUPPORT_TIME_H__ */
#endif /* __GRPC_SUPPORT_TIME_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/time_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@

typedef struct timespec gpr_timespec;

#endif /* __GRPC_SUPPORT_TIME_POSIX_H__ */
#endif /* __GRPC_SUPPORT_TIME_POSIX_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/time_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ typedef struct gpr_timespec {
long tv_nsec;
} gpr_timespec;

#endif /* __GRPC_SUPPORT_TIME_WIN32_H__ */
#endif /* __GRPC_SUPPORT_TIME_WIN32_H__ */
2 changes: 1 addition & 1 deletion include/grpc/support/useful.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@

#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))

#endif /* __GRPC_SUPPORT_USEFUL_H__ */
#endif /* __GRPC_SUPPORT_USEFUL_H__ */
Loading

0 comments on commit b5dcec5

Please sign in to comment.