Skip to content

Commit 3d85957

Browse files
committed
platform: fix coding style
1 parent fbdbfff commit 3d85957

File tree

8 files changed

+94
-82
lines changed

8 files changed

+94
-82
lines changed

platform/CThunk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class CThunk: public CThunkBase {
104104

105105
inline void context(uint32_t context)
106106
{
107-
_context = (void*)context;
107+
_context = (void *)context;
108108
}
109109

110110
inline uint32_t entry(void)

platform/CThunkBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef void (*CThunkEntry)(void);
2222

2323
class CThunkBase {
2424
protected:
25-
typedef void (*Trampoline)(CThunkBase*);
25+
typedef void (*Trampoline)(CThunkBase *);
2626

2727
Trampoline _trampoline;
2828

platform/DirHandle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace mbed {
3030
*/
3131

3232

33-
/** Represents a directory stream. An opendir function returns
33+
/** Represents a directory stream. An opendir function returns
3434
* objects of this type. The core functions are read and seek,
3535
* but only a subset needs to be provided.
3636
*

platform/NonCopyable.h

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -31,96 +31,96 @@ namespace mbed {
3131
*/
3232

3333
/**
34-
* Prevents generation of copy constructor and copy assignment operator in
34+
* Prevents generation of copy constructor and copy assignment operator in
3535
* derived classes.
36-
*
36+
*
3737
* @par Usage
38-
*
39-
* To prevent generation of copy constructor and copy assignment operator,
40-
* inherit privately from the NonCopyable class.
41-
*
42-
* @code
38+
*
39+
* To prevent generation of copy constructor and copy assignment operator,
40+
* inherit privately from the NonCopyable class.
41+
*
42+
* @code
4343
* class Resource : NonCopyable<Resource> { };
44-
*
44+
*
4545
* Resource r;
4646
* // generates compile time error:
4747
* Resource r2 = r;
4848
* @endcode
49-
*
49+
*
5050
* @par Background information
51-
*
52-
* Instances of polymorphic classes are not meant to be copied. The
53-
* C++ standards generate a default copy constructor and copy assignment
51+
*
52+
* Instances of polymorphic classes are not meant to be copied. The
53+
* C++ standards generate a default copy constructor and copy assignment
5454
* function if these functions have not been defined in the class.
55-
*
55+
*
5656
* Consider the following example:
57-
*
57+
*
5858
* @code
5959
* // base class representing a connection
60-
* struct Connection {
60+
* struct Connection {
6161
* Connection();
6262
* virtual ~Connection();
6363
* virtual void open() = 0;
6464
* }
65-
*
66-
* class SerialConnection : public Connection {
65+
*
66+
* class SerialConnection : public Connection {
6767
* public:
6868
* SerialConnection(Serial*);
69-
*
69+
*
7070
* private:
7171
* Serial* _serial;
7272
* };
73-
*
74-
* Connection& get_connection() {
73+
*
74+
* Connection& get_connection() {
7575
* static SerialConnection serial_connection;
7676
* return serial_connection;
7777
* }
7878
*
7979
* Connection connection = get_connection();
8080
* @endcode
81-
*
82-
* There is a subtle bug in this code, the function get_connection returns a
83-
* reference to a Connection which is captured by value instead of reference.
84-
*
85-
* When `get_connection` returns a reference to serial_connection it is copied into
86-
* the local variable connection. The vtable and others members defined in Connection
87-
* are copied, but members defined in SerialConnection are left apart. This can cause
88-
* severe crashes or bugs if the virtual functions captured use members not present
81+
*
82+
* There is a subtle bug in this code, the function get_connection returns a
83+
* reference to a Connection which is captured by value instead of reference.
84+
*
85+
* When `get_connection` returns a reference to serial_connection it is copied into
86+
* the local variable connection. The vtable and others members defined in Connection
87+
* are copied, but members defined in SerialConnection are left apart. This can cause
88+
* severe crashes or bugs if the virtual functions captured use members not present
8989
* in the base declaration.
90-
*
91-
* To solve that problem, the copy constructor and assignment operator have to
92-
* be declared (but don't need to be defined) in the private section of the
90+
*
91+
* To solve that problem, the copy constructor and assignment operator have to
92+
* be declared (but don't need to be defined) in the private section of the
9393
* Connection class:
94-
*
94+
*
9595
* @code
96-
* struct Connection {
96+
* struct Connection {
9797
* private:
9898
* Connection(const Connection&);
9999
* Connection& operator=(const Connection&);
100100
* }
101101
* @endcode
102-
*
103-
* Although manually declaring private copy constructor and assignment functions
104-
* works, it is not ideal. These declarations are usually easy to forget,
102+
*
103+
* Although manually declaring private copy constructor and assignment functions
104+
* works, it is not ideal. These declarations are usually easy to forget,
105105
* not immediately visible, and may be obscure to uninformed programmers.
106-
*
107-
* Using the NonCopyable class reduces the boilerplate required and expresses
106+
*
107+
* Using the NonCopyable class reduces the boilerplate required and expresses
108108
* the intent because class inheritance appears right after the class name
109109
* declaration.
110-
*
110+
*
111111
* @code
112-
* struct Connection : private NonCopyable<Connection> {
112+
* struct Connection : private NonCopyable<Connection> {
113113
* // regular declarations
114114
* }
115115
* @endcode
116-
*
117-
*
118-
* @par Implementation details
119-
*
120-
* Using a template type prevents cases where the empty base optimization cannot
121-
* be applied and therefore ensures that the cost of the NonCopyable semantic
116+
*
117+
*
118+
* @par Implementation details
119+
*
120+
* Using a template type prevents cases where the empty base optimization cannot
121+
* be applied and therefore ensures that the cost of the NonCopyable semantic
122122
* sugar is null.
123-
*
123+
*
124124
* As an example, the empty base optimization is prohibited if one of the empty
125125
* base classes is also a base type of the first nonstatic data member:
126126
*
@@ -157,7 +157,7 @@ namespace mbed {
157157
* // kind of A. sizeof(C) == sizeof(B) == sizeof(int).
158158
* @endcode
159159
*
160-
* @tparam T The type that should be made noncopyable.
160+
* @tparam T The type that should be made noncopyable.
161161
*
162162
* @note Compile time errors are disabled if you use the develop or release profile.
163163
* To override this behavior and force compile time errors in all profiles,
@@ -222,7 +222,7 @@ class NonCopyable {
222222
*/
223223
NonCopyable &operator=(const NonCopyable &);
224224
#endif
225-
#endif
225+
#endif
226226
};
227227

228228
/**@}*/

platform/Span.h

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ namespace span_detail {
3939
// If From type is convertible to To type, then the compilation constant value is
4040
// true; otherwise, it is false.
4141
template<typename From, typename To>
42-
class is_convertible
43-
{
44-
struct true_type { char x[512]; };
42+
class is_convertible {
43+
struct true_type {
44+
char x[512];
45+
};
4546
struct false_type { };
4647

47-
static const From& generator();
48+
static const From &generator();
4849
static true_type sink(const To &);
4950
static false_type sink(...);
5051

@@ -59,11 +60,11 @@ class is_convertible
5960
* Special value for the Extent parameter of Span.
6061
* If the type uses this value, then the size of the array is stored in the object
6162
* at runtime.
62-
*
63+
*
6364
* @relates Span
6465
*/
6566
const ptrdiff_t SPAN_DYNAMIC_EXTENT = -1;
66-
#else
67+
#else
6768
#define SPAN_DYNAMIC_EXTENT -1
6869
#endif
6970

@@ -293,6 +294,8 @@ struct Span {
293294
MBED_ASSERT(Extent == 0 || first != NULL);
294295
}
295296

297+
// AStyle ignore, not handling correctly below
298+
// *INDENT-OFF*
296299
/**
297300
* Construct a Span from the reference to an array.
298301
*
@@ -322,6 +325,7 @@ struct Span {
322325
"OtherElementType(*)[] should be convertible to ElementType (*)[]"
323326
);
324327
}
328+
// *INDENT-ON*
325329

326330
/**
327331
* Return the size of the sequence viewed.
@@ -409,6 +413,8 @@ struct Span {
409413
return Span<element_type, Count>(_data + (Extent - Count), Count);
410414
}
411415

416+
// AStyle ignore, not handling correctly below
417+
// *INDENT-OFF*
412418
/**
413419
* Create a subspan that is a view of other Count elements; the view starts at
414420
* element Offset.
@@ -439,6 +445,7 @@ struct Span {
439445
Count == SPAN_DYNAMIC_EXTENT ? Extent - Offset : Count
440446
);
441447
}
448+
// *INDENT-ON*
442449

443450
/**
444451
* Create a new Span over the first @p count elements of the existing view.
@@ -464,9 +471,9 @@ struct Span {
464471
{
465472
MBED_ASSERT(0 <= count && count <= Extent);
466473
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
467-
_data + (Extent - count),
468-
count
469-
);
474+
_data + (Extent - count),
475+
count
476+
);
470477
}
471478

472479
/**
@@ -491,9 +498,9 @@ struct Span {
491498
(0 <= count && (count + offset) <= Extent)
492499
);
493500
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
494-
_data + offset,
495-
count == SPAN_DYNAMIC_EXTENT ? Extent - offset : count
496-
);
501+
_data + offset,
502+
count == SPAN_DYNAMIC_EXTENT ? Extent - offset : count
503+
);
497504
}
498505

499506
private:
@@ -579,6 +586,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
579586
MBED_ASSERT(first != NULL || (last - first) == 0);
580587
}
581588

589+
// AStyle ignore, not handling correctly below
590+
// *INDENT-OFF*
582591
/**
583592
* Construct a Span from the reference to an array.
584593
*
@@ -611,6 +620,7 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
611620
"OtherElementType(*)[] should be convertible to ElementType (*)[]"
612621
);
613622
}
623+
// *INDENT-ON*
614624

615625
/**
616626
* Return the size of the array viewed.
@@ -713,9 +723,9 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
713723
(0 <= Count && (Count + Offset) <= _size)
714724
);
715725
return Span<element_type, Count>(
716-
_data + Offset,
717-
Count == SPAN_DYNAMIC_EXTENT ? _size - Offset : Count
718-
);
726+
_data + Offset,
727+
Count == SPAN_DYNAMIC_EXTENT ? _size - Offset : Count
728+
);
719729
}
720730

721731
/**
@@ -742,9 +752,9 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
742752
{
743753
MBED_ASSERT(0 <= count && count <= _size);
744754
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
745-
_data + (_size - count),
746-
count
747-
);
755+
_data + (_size - count),
756+
count
757+
);
748758
}
749759

750760
/**
@@ -769,9 +779,9 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
769779
(0 <= count && (count + offset) <= _size)
770780
);
771781
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
772-
_data + offset,
773-
count == SPAN_DYNAMIC_EXTENT ? _size - offset : count
774-
);
782+
_data + offset,
783+
count == SPAN_DYNAMIC_EXTENT ? _size - offset : count
784+
);
775785
}
776786

777787
private:
@@ -787,7 +797,7 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
787797
*
788798
* @return True if Spans in input have the same size and the same content and
789799
* false otherwise.
790-
*
800+
*
791801
* @relates Span
792802
*/
793803
template<typename T, typename U, ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
@@ -804,6 +814,8 @@ bool operator==(const Span<T, LhsExtent> &lhs, const Span<U, RhsExtent> &rhs)
804814
return std::equal(lhs.data(), lhs.data() + lhs.size(), rhs.data());
805815
}
806816

817+
// AStyle ignore, not handling correctly below
818+
// *INDENT-OFF*
807819
/**
808820
* Equality operation between a Span and a reference to a C++ array.
809821
*
@@ -842,7 +854,7 @@ bool operator==(T (&lhs)[LhsExtent], const Span<T, RhsExtent> &rhs)
842854
*
843855
* @return True if arrays in input do not have the same size or the same content
844856
* and false otherwise.
845-
*
857+
*
846858
* @relates Span
847859
*/
848860
template<typename T, typename U, ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
@@ -893,7 +905,7 @@ bool operator!=(T (&lhs)[LhsExtent], const Span<T, RhsExtent> &rhs)
893905
*
894906
* @note This helper avoids the typing of template parameter when Span is
895907
* created 'inline'.
896-
*
908+
*
897909
* @relates Span
898910
*/
899911
template<typename T, size_t Size>
@@ -959,7 +971,7 @@ Span<const T, Extent> make_const_Span(const T (&elements)[Extent])
959971
{
960972
return Span<const T, Extent>(elements);
961973
}
962-
974+
// *INDENT-ON*
963975
/**
964976
* Generate a Span to a const content from a pointer to a C/C++ array.
965977
*
@@ -972,7 +984,7 @@ Span<const T, Extent> make_const_Span(const T (&elements)[Extent])
972984
*
973985
* @note This helper avoids the typing of template parameter when Span is
974986
* created 'inline'.
975-
*
987+
*
976988
* @relates Span
977989
*/
978990
template<size_t Extent, typename T>
@@ -994,7 +1006,7 @@ Span<const T, Extent> make_const_Span(const T *elements)
9941006
*
9951007
* @note This helper avoids the typing of template parameter when Span is
9961008
* created 'inline'.
997-
*
1009+
*
9981010
* @relates Span
9991011
*/
10001012
template<typename T>

0 commit comments

Comments
 (0)