srctree

Mikael Larsson parent 75f15daa dc6cf451 c0e25deb
Merge pull request #33 from robinlinden/clang-format

Add clang-format travis job
.clang-format added: 42, removed: 43, total 0
@@ -2,13 +2,13 @@
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
@@ -18,9 +18,9 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
@@ -52,16 +52,16 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
@@ -94,10 +94,10 @@ PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
PointerAlignment: Right
RawStringFormats:
- Language: Cpp
Delimiters:
Delimiters:
- cc
- CC
- cpp
@@ -108,12 +108,12 @@ RawStringFormats:
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
 
.travis.yml added: 42, removed: 43, total 0
@@ -54,6 +54,16 @@ matrix:
- CXX=clang++-7 cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
- run-clang-tidy-7.py -q -p . "core|application"
 
- name: "clang-format"
addons:
apt:
packages:
- clang-format
before_script: []
script:
- find application core -name *.h -o -name *.cpp | xargs clang-format -style=file -i
- git diff --exit-code
 
before_script:
- mkdir _build && cd _build
- eval "${MATRIX_EVAL}"
 
core/src/mos6502.cpp added: 42, removed: 43, total 0
@@ -101,21 +101,15 @@ void Mos6502::execute() {
pipeline_.push([=]() {
/* Do nothing. */
});
pipeline_.push([=]() {
stack_.push_word(registers_->pc);
});
pipeline_.push([=]() {
stack_.push_byte(registers_->p | B_FLAG);
});
pipeline_.push([=]() { stack_.push_word(registers_->pc); });
pipeline_.push([=]() { stack_.push_byte(registers_->p | B_FLAG); });
pipeline_.push([=]() { ++registers_->pc; });
pipeline_.push(
[=]() { registers_->pc = mmu_->read_word(kBrkAddress); });
return;
case PHP:
pipeline_.push([=]() { ++registers_->pc; });
pipeline_.push([=]() {
stack_.push_byte(registers_->p);
});
pipeline_.push([=]() { stack_.push_byte(registers_->p); });
return;
case BPL:
pipeline_.push(
@@ -125,8 +119,7 @@ void Mos6502::execute() {
pipeline_.push([=]() { clear_flag(C_FLAG); });
return;
case BMI:
pipeline_.push(
branch_on([=]() { return registers_->p & N_FLAG; }));
pipeline_.push(branch_on([=]() { return registers_->p & N_FLAG; }));
return;
case SEC:
pipeline_.push([=]() { set_flag(C_FLAG); });
@@ -142,9 +135,7 @@ void Mos6502::execute() {
return;
case PHA:
pipeline_.push([=]() { ++registers_->pc; });
pipeline_.push([=]() {
stack_.push_byte(registers_->a);
});
pipeline_.push([=]() { stack_.push_byte(registers_->a); });
return;
case JMP:
pipeline_.push([=]() { ++registers_->pc; });
@@ -160,8 +151,7 @@ void Mos6502::execute() {
pipeline_.push([=]() { clear_flag(I_FLAG); });
return;
case BVS:
pipeline_.push(
branch_on([=]() { return registers_->p & V_FLAG; }));
pipeline_.push(branch_on([=]() { return registers_->p & V_FLAG; }));
return;
case SEI:
pipeline_.push([=]() { set_flag(I_FLAG); });
@@ -178,8 +168,7 @@ void Mos6502::execute() {
});
return;
case BCS:
pipeline_.push(
branch_on([=]() { return registers_->p & C_FLAG; }));
pipeline_.push(branch_on([=]() { return registers_->p & C_FLAG; }));
return;
case CLV:
pipeline_.push([=]() { clear_flag(V_FLAG); });
@@ -202,8 +191,7 @@ void Mos6502::execute() {
});
return;
case BEQ:
pipeline_.push(
branch_on([=]() { return registers_->p & Z_FLAG; }));
pipeline_.push(branch_on([=]() { return registers_->p & Z_FLAG; }));
return;
case SED:
pipeline_.push([=]() { set_flag(D_FLAG); });
 
core/test/src/test_cpu.cpp added: 42, removed: 43, total 0
@@ -76,8 +76,7 @@ public:
}
}
 
void branch_test(
uint8_t branch_flag,
void branch_test(uint8_t branch_flag,
int8_t offset,
uint8_t expected_cycles) {
expected.p = registers.p = branch_flag;
@@ -135,10 +134,12 @@ TEST_F(CpuTest, brk) {
ON_CALL(mmu, read_word(kBrkAddress)).WillByDefault(Return(0xDEAD));
 
// First the return address is pushed and then the registers.
EXPECT_CALL(mmu, write_word(kStackOffset + expected_pc_stack_addr,
registers.pc + 2));
EXPECT_CALL(mmu, write_byte(kStackOffset + expected_p_stack_addr,
registers.p | B_FLAG));
EXPECT_CALL(mmu,
write_word(
kStackOffset + expected_pc_stack_addr, registers.pc + 2));
EXPECT_CALL(mmu,
write_byte(kStackOffset + expected_p_stack_addr,
registers.p | B_FLAG));
 
step_execution(7);