Skip to content

Commit 763b528

Browse files
committed
New styleguide
Summary: The old one wasn't working right and confusing. This one is simpler and works.. Test Plan: N/A Reviewers: O1 The Ori, brookea Reviewed By: O1 The Ori, brookea Subscribers: brookea Tags: #zorp Differential Revision: http://phabricator.purduesigbots.com/D85
1 parent 6cd7c77 commit 763b528

39 files changed

+2788
-3317
lines changed

.clang-format

+11-45
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,15 @@
1-
BasedOnStyle: LLVM
2-
AlignAfterOpenBracket: Align
3-
# AlignEscapedNewlines: Right
4-
AlignOperands: true
5-
AlignTrailingComments: true
6-
AllowAllParametersOfDeclarationOnNextLine: false
7-
AllowShortBlocksOnASingleLine: false
8-
AllowShortCaseLabelsOnASingleLine: false
9-
AllowShortFunctionsOnASingleLine: Empty
10-
AllowShortIfStatementsOnASingleLine: true
11-
AllowShortLoopsOnASingleLine: true
12-
AlwaysBreakAfterReturnType: None
13-
AlwaysBreakBeforeMultilineStrings: false
14-
AlwaysBreakTemplateDeclarations: false
15-
BinPackArguments: true
16-
BinPackParameters: false
17-
BreakBeforeBraces: Attach
18-
BreakBeforeBinaryOperators: None
19-
# BreakBeforeInheritanceComma: false
20-
BreakBeforeTernaryOperators: true
21-
# BreakStringLiterals: true
22-
ColumnLimit: 120
23-
# CompactNamespaces: False
24-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
25-
Cpp11BracedListStyle: false
26-
DerivePointerAlignment: false
27-
# FixNamespaceComments: true
28-
IndentCaseLabels: false
29-
IndentWidth: 8
30-
IndentWrappedFunctionNames: true
1+
BasedOnStyle: Google
2+
TabWidth: 2
313
Language: Cpp
32-
NamespaceIndentation: Inner
33-
SortIncludes: true
34-
# SortUsingDeclarations: true
35-
SpaceAfterCStyleCast: false
36-
# SpaceAfterTemplateKeyword: false
37-
SpaceBeforeAssignmentOperators: true
38-
SpaceBeforeParens: ControlStatements
39-
SpaceInEmptyParentheses: false
40-
SpacesBeforeTrailingComments: 2
41-
SpacesInAngles: false
42-
SpacesInCStyleCastParentheses: false
43-
SpacesInContainerLiterals: false
44-
SpacesInParentheses: false
45-
SpacesInSquareBrackets: false
46-
Standard: Cpp11
474
UseTab: ForIndentation
5+
ColumnLimit: 120
6+
Standard: Cpp11
7+
DerivePointerAlignment: false
488
PointerAlignment: Left
9+
FixNamespaceComments: true
10+
ReflowComments: true
11+
SortIncludes: true
4912
AccessModifierOffset: 0
13+
AllowShortBlocksOnASingleLine: false
14+
AllowShortCaseLabelsOnASingleLine: false
15+
AllowShortFunctionsOnASingleLine: Empty

STYLEGUIDE.md

+16-462
Large diffs are not rendered by default.

include/common/linkedlist.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ typedef struct ll_node_s {
2424
struct ll_node_s* next;
2525
} ll_node_s_t;
2626

27-
typedef struct { ll_node_s_t* head; } linked_list_s_t;
27+
typedef struct {
28+
ll_node_s_t* head;
29+
} linked_list_s_t;
2830

2931
/**
3032
* \brief Initialize a linked list node storing an arbitrary function pointer

include/common/set.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
#pragma once
1515

16-
#include "kapi.h"
1716
#include <stdbool.h>
1817
#include <stddef.h>
1918
#include <stdint.h>
19+
#include "kapi.h"
2020

2121
struct set {
2222
uint32_t* arr;

include/kapi.h

+9-14
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ extern "C" {
3434
#define kprint(str) kprintf("%s", str)
3535

3636
#ifndef PROS_RELEASING
37-
#define kassert(cond) \
38-
do { \
39-
if (!(cond)) { \
40-
kprint("Assertion failed: " #cond); \
41-
} \
37+
#define kassert(cond) \
38+
do { \
39+
if (!(cond)) { \
40+
kprint("Assertion failed: " #cond); \
41+
} \
4242
} while (0)
4343
#else
4444
#define kassert(cond)
@@ -73,13 +73,8 @@ int32_t rtos_resume_all(void);
7373
* Creates a task using statically allocated buffers. All tasks used by the PROS
7474
* system must use statically allocated buffers.
7575
*/
76-
task_t task_create_static(task_fn_t task_code,
77-
void* const param,
78-
uint32_t priority,
79-
const size_t stack_size,
80-
const char* const name,
81-
task_stack_t* const stack_buffer,
82-
static_task_s_t* const task_buffer);
76+
task_t task_create_static(task_fn_t task_code, void* const param, uint32_t priority, const size_t stack_size,
77+
const char* const name, task_stack_t* const stack_buffer, static_task_s_t* const task_buffer);
8378

8479
/**
8580
* Creates a statically allocated mutex. See the documentation in api.h for mutex_create().
@@ -100,8 +95,8 @@ sem_t sem_create_static(uint32_t uxMaxCount, uint32_t uxInitialCount, static_sem
10095
*
10196
* All FreeRTOS primitives must be created statically if they are required for operation of the kernel.
10297
*/
103-
queue_t
104-
queue_create_static(uint32_t length, uint32_t item_size, uint8_t* storage_buffer, static_queue_s_t* queue_buffer);
98+
queue_t queue_create_static(uint32_t length, uint32_t item_size, uint8_t* storage_buffer,
99+
static_queue_s_t* queue_buffer);
105100

106101
/**
107102
* \brief Display a non-fatal error to the built-in LCD/touch screen.

0 commit comments

Comments
 (0)