Style: Format code with clang-format 6.0.1

(cherry picked from commit 7c9f7452f4)

Travis: Update style checks to clang-format 6.0.1

(cherry picked from commit 003ac67df1)
This commit is contained in:
Rémi Verschelde 2018-07-18 16:24:33 +02:00
parent d859aa1438
commit c709dff1a2
24 changed files with 40 additions and 50 deletions

View File

@ -1,6 +1,6 @@
# Commented out parameters are those with the same value as base LLVM style # Commented out parameters are those with the same value as base LLVM style
# We can uncomment them if we want to change their value, or enforce the # We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 5.0.0). # chosen value in case the base style changes (last sync: Clang 6.0.1).
--- ---
### General config, applies to all languages ### ### General config, applies to all languages ###
BasedOnStyle: LLVM BasedOnStyle: LLVM
@ -32,6 +32,7 @@ AllowShortIfStatementsOnASingleLine: true
# AfterObjCDeclaration: false # AfterObjCDeclaration: false
# AfterStruct: false # AfterStruct: false
# AfterUnion: false # AfterUnion: false
# AfterExternBlock: false
# BeforeCatch: false # BeforeCatch: false
# BeforeElse: false # BeforeElse: false
# IndentBraces: false # IndentBraces: false
@ -60,6 +61,7 @@ Cpp11BracedListStyle: false
# - foreach # - foreach
# - Q_FOREACH # - Q_FOREACH
# - BOOST_FOREACH # - BOOST_FOREACH
# IncludeBlocks: Preserve
IncludeCategories: IncludeCategories:
- Regex: '".*"' - Regex: '".*"'
Priority: 1 Priority: 1
@ -69,6 +71,7 @@ IncludeCategories:
Priority: 3 Priority: 3
# IncludeIsMainRegex: '(Test)?$' # IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true IndentCaseLabels: true
# IndentPPDirectives: None
IndentWidth: 4 IndentWidth: 4
# IndentWrappedFunctionNames: false # IndentWrappedFunctionNames: false
# JavaScriptQuotes: Leave # JavaScriptQuotes: Leave
@ -86,6 +89,10 @@ IndentWidth: 4
# PenaltyExcessCharacter: 1000000 # PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60 # PenaltyReturnTypeOnItsOwnLine: 60
# PointerAlignment: Right # PointerAlignment: Right
# RawStringFormats:
# - Delimiter: pb
# Language: TextProto
# BasedOnStyle: google
# ReflowComments: true # ReflowComments: true
# SortIncludes: true # SortIncludes: true
# SortUsingDeclarations: true # SortUsingDeclarations: true

View File

@ -44,7 +44,7 @@ addons:
apt: apt:
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0 - llvm-toolchain-trusty-6.0
packages: packages:
- build-essential - build-essential
- scons - scons
@ -70,7 +70,7 @@ addons:
#- mingw-w64 #- mingw-w64
# For style checks. # For style checks.
- clang-format-5.0 - clang-format-6.0
install: install:
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "android" ]; then - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "android" ]; then

View File

@ -74,7 +74,7 @@ T *_nullptr() {
#define OFFSET_OF(st, m) \ #define OFFSET_OF(st, m) \
((size_t)((char *)&(_nullptr<st>()->m) - (char *)0)) ((size_t)((char *)&(_nullptr<st>()->m) - (char *)0))
/** /**
* Some platforms (devices) not define NULL * Some platforms (devices) not define NULL
*/ */
@ -82,7 +82,7 @@ T *_nullptr() {
#define NULL 0 #define NULL 0
#endif #endif
/** /**
* Windows defines a lot of badly stuff we'll never ever use. undefine it. * Windows defines a lot of badly stuff we'll never ever use. undefine it.
*/ */
@ -104,7 +104,7 @@ T *_nullptr() {
#include "error_list.h" #include "error_list.h"
#include "error_macros.h" #include "error_macros.h"
/** Generic ABS function, for math uses please use Math::abs */ /** Generic ABS function, for math uses please use Math::abs */
#ifndef ABS #ifndef ABS
#define ABS(m_v) ((m_v < 0) ? (-(m_v)) : (m_v)) #define ABS(m_v) ((m_v < 0) ? (-(m_v)) : (m_v))

View File

@ -2957,10 +2957,10 @@ NavigationMeshSpatialGizmo::NavigationMeshSpatialGizmo(NavigationMeshInstance *p
navmesh = p_navmesh; navmesh = p_navmesh;
} }
////// //////
/// ///
/// ///
/// ///
#define BODY_A_RADIUS 0.25 #define BODY_A_RADIUS 0.25
#define BODY_B_RADIUS 0.27 #define BODY_B_RADIUS 0.27

View File

@ -1126,7 +1126,7 @@ void GDScriptTokenizerText::advance(int p_amount) {
_advance(); _advance();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////
#define BYTECODE_VERSION 12 #define BYTECODE_VERSION 12

View File

@ -880,4 +880,4 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict) {
return ret; return ret;
} }
} } // namespace GDMonoMarshal

View File

@ -240,11 +240,11 @@ ResourceFormatPVR::ResourceFormatPVR() {
Image::_image_compress_pvrtc2_func = _compress_pvrtc4; Image::_image_compress_pvrtc2_func = _compress_pvrtc4;
} }
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//PVRTC decompressor, Based on PVRTC decompressor by IMGTEC. //PVRTC decompressor, Based on PVRTC decompressor by IMGTEC.
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
#define PT_INDEX 2 #define PT_INDEX 2
#define BLK_Y_SIZE 4 #define BLK_Y_SIZE 4

View File

@ -48,7 +48,7 @@ size_t AudioStreamPlaybackOGGVorbis::_ov_read_func(void *p_dst, size_t p_data, s
int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f, ogg_int64_t offs, int whence) { int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f, ogg_int64_t offs, int whence) {
//printf("seek to %p, offs %i, whence %i\n",_f,(int)offs,whence); //printf("seek to %p, offs %i, whence %i\n",_f,(int)offs,whence);
#ifdef SEEK_SET #ifdef SEEK_SET
//printf("seek set defined\n"); //printf("seek set defined\n");

View File

@ -42,7 +42,8 @@ void AudioDriverOpenSL::_buffer_callback(
/* SLuint32 eventFlags, /* SLuint32 eventFlags,
const void * pBuffer, const void * pBuffer,
SLuint32 bufferSize, SLuint32 bufferSize,
SLuint32 dataUsed*/) { SLuint32 dataUsed*/
) {
bool mix = true; bool mix = true;

View File

@ -74,7 +74,8 @@ class AudioDriverOpenSL : public AudioDriver {
/* SLuint32 eventFlags, /* SLuint32 eventFlags,
const void * pBuffer, const void * pBuffer,
SLuint32 bufferSize, SLuint32 bufferSize,
SLuint32 dataUsed*/); SLuint32 dataUsed*/
);
static void _buffer_callbacks( static void _buffer_callbacks(
SLAndroidSimpleBufferQueueItf queueItf, SLAndroidSimpleBufferQueueItf queueItf,

View File

@ -66,7 +66,6 @@ abstract public class ConsumeTask {
} }
final String token = _token; final String token = _token;
new AsyncTask<String, String, String>() { new AsyncTask<String, String, String>() {
@Override @Override
protected String doInBackground(String... params) { protected String doInBackground(String... params) {
try { try {
@ -89,7 +88,6 @@ abstract public class ConsumeTask {
error(param); error(param);
} }
} }
} }
.execute(); .execute();
} }

View File

@ -103,7 +103,6 @@ public class PaymentsManager {
public void requestPurchase(final String sku, String transactionId) { public void requestPurchase(final String sku, String transactionId) {
new PurchaseTask(mService, Godot.getInstance()) { new PurchaseTask(mService, Godot.getInstance()) {
@Override @Override
protected void error(String message) { protected void error(String message) {
godotPaymentV3.callbackFail(); godotPaymentV3.callbackFail();
@ -118,14 +117,12 @@ public class PaymentsManager {
protected void alreadyOwned() { protected void alreadyOwned() {
godotPaymentV3.callbackAlreadyOwned(sku); godotPaymentV3.callbackAlreadyOwned(sku);
} }
} }
.purchase(sku, transactionId); .purchase(sku, transactionId);
} }
public void consumeUnconsumedPurchases() { public void consumeUnconsumedPurchases() {
new ReleaseAllConsumablesTask(mService, activity) { new ReleaseAllConsumablesTask(mService, activity) {
@Override @Override
protected void success(String sku, String receipt, String signature, String token) { protected void success(String sku, String receipt, String signature, String token) {
godotPaymentV3.callbackSuccessProductMassConsumed(receipt, signature, sku); godotPaymentV3.callbackSuccessProductMassConsumed(receipt, signature, sku);
@ -194,14 +191,12 @@ public class PaymentsManager {
public void processPurchaseResponse(int resultCode, Intent data) { public void processPurchaseResponse(int resultCode, Intent data) {
new HandlePurchaseTask(activity) { new HandlePurchaseTask(activity) {
@Override @Override
protected void success(final String sku, final String signature, final String ticket) { protected void success(final String sku, final String signature, final String ticket) {
godotPaymentV3.callbackSuccess(ticket, signature, sku); godotPaymentV3.callbackSuccess(ticket, signature, sku);
if (auto_consume) { if (auto_consume) {
new ConsumeTask(mService, activity) { new ConsumeTask(mService, activity) {
@Override @Override
protected void success(String ticket) { protected void success(String ticket) {
} }
@ -231,12 +226,10 @@ public class PaymentsManager {
public void validatePurchase(String purchaseToken, final String sku) { public void validatePurchase(String purchaseToken, final String sku) {
new ValidateTask(activity, godotPaymentV3) { new ValidateTask(activity, godotPaymentV3) {
@Override @Override
protected void success() { protected void success() {
new ConsumeTask(mService, activity) { new ConsumeTask(mService, activity) {
@Override @Override
protected void success(String ticket) { protected void success(String ticket) {
godotPaymentV3.callbackSuccess(ticket, null, sku); godotPaymentV3.callbackSuccess(ticket, null, sku);
@ -269,7 +262,6 @@ public class PaymentsManager {
public void consume(final String sku) { public void consume(final String sku) {
new ConsumeTask(mService, activity) { new ConsumeTask(mService, activity) {
@Override @Override
protected void success(String ticket) { protected void success(String ticket) {
godotPaymentV3.callbackSuccessProductMassConsumed(ticket, "", sku); godotPaymentV3.callbackSuccessProductMassConsumed(ticket, "", sku);

View File

@ -88,7 +88,6 @@ abstract public class ReleaseAllConsumablesTask {
String signature = mySignatures.get(i); String signature = mySignatures.get(i);
//Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt); //Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
new GenericConsumeTask(context, mService, sku, receipt, signature, token) { new GenericConsumeTask(context, mService, sku, receipt, signature, token) {
@Override @Override
public void onSuccess(String sku, String receipt, String signature, String token) { public void onSuccess(String sku, String receipt, String signature, String token) {
ReleaseAllConsumablesTask.this.success(sku, receipt, signature, token); ReleaseAllConsumablesTask.this.success(sku, receipt, signature, token);

View File

@ -63,7 +63,6 @@ abstract public class ValidateTask {
public void validatePurchase(final String sku) { public void validatePurchase(final String sku) {
new AsyncTask<String, String, String>() { new AsyncTask<String, String, String>() {
private ProgressDialog dialog; private ProgressDialog dialog;
@Override @Override
@ -113,7 +112,6 @@ abstract public class ValidateTask {
error(e.getMessage()); error(e.getMessage());
} }
} }
} }
.execute(); .execute();
} }

View File

@ -139,7 +139,6 @@ Error GameCenter::post_score(Variant p_score) {
[GKScore reportScores:@[ reporter ] [GKScore reportScores:@[ reporter ]
withCompletionHandler:^(NSError *error) { withCompletionHandler:^(NSError *error) {
Dictionary ret; Dictionary ret;
ret["type"] = "post_score"; ret["type"] = "post_score";
if (error == nil) { if (error == nil) {
@ -177,7 +176,6 @@ Error GameCenter::award_achievement(Variant p_params) {
[GKAchievement reportAchievements:@[ achievement ] [GKAchievement reportAchievements:@[ achievement ]
withCompletionHandler:^(NSError *error) { withCompletionHandler:^(NSError *error) {
Dictionary ret; Dictionary ret;
ret["type"] = "award_achievement"; ret["type"] = "award_achievement";
if (error == nil) { if (error == nil) {
@ -196,7 +194,6 @@ Error GameCenter::award_achievement(Variant p_params) {
void GameCenter::request_achievement_descriptions() { void GameCenter::request_achievement_descriptions() {
[GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:^(NSArray *descriptions, NSError *error) { [GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:^(NSArray *descriptions, NSError *error) {
Dictionary ret; Dictionary ret;
ret["type"] = "achievement_descriptions"; ret["type"] = "achievement_descriptions";
if (error == nil) { if (error == nil) {
@ -252,7 +249,6 @@ void GameCenter::request_achievement_descriptions() {
void GameCenter::request_achievements() { void GameCenter::request_achievements() {
[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) { [GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) {
Dictionary ret; Dictionary ret;
ret["type"] = "achievements"; ret["type"] = "achievements";
if (error == nil) { if (error == nil) {
@ -347,7 +343,6 @@ Error GameCenter::request_identity_verification_signature() {
GKLocalPlayer *player = [GKLocalPlayer localPlayer]; GKLocalPlayer *player = [GKLocalPlayer localPlayer];
[player generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) { [player generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) {
Dictionary ret; Dictionary ret;
ret["type"] = "identity_verification_signature"; ret["type"] = "identity_verification_signature";
if (error == nil) { if (error == nil) {

View File

@ -392,7 +392,6 @@ void OSUWP::ManagedType::update_clipboard() {
if (data->Contains(StandardDataFormats::Text)) { if (data->Contains(StandardDataFormats::Text)) {
create_task(data->GetTextAsync()).then([this](Platform::String ^ clipboard_content) { create_task(data->GetTextAsync()).then([this](Platform::String ^ clipboard_content) {
this->clipboard = clipboard_content; this->clipboard = clipboard_content;
}); });
} }

View File

@ -176,8 +176,8 @@ int _main() {
} }
int main(int _argc, char **_argv) { int main(int _argc, char **_argv) {
// _argc and _argv are ignored // _argc and _argv are ignored
// we are going to use the WideChar version of them instead // we are going to use the WideChar version of them instead
#ifdef CRASH_HANDLER_EXCEPTION #ifdef CRASH_HANDLER_EXCEPTION
__try { __try {

View File

@ -113,7 +113,7 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \ rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
if (min > rad || max < -rad) return false; if (min > rad || max < -rad) return false;
/*======================== Z-tests ========================*/ /*======================== Z-tests ========================*/
#define AXISTEST_Z12(a, b, fa, fb) \ #define AXISTEST_Z12(a, b, fa, fb) \
p1 = a * v1.x - b * v1.y; \ p1 = a * v1.x - b * v1.y; \

View File

@ -238,7 +238,7 @@ void Node::_propagate_enter_tree() {
void Node::_propagate_exit_tree() { void Node::_propagate_exit_tree() {
//block while removing children //block while removing children
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED