1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-23 04:04:54 +08:00

Remove the struct keywords from operator returns, as this is a problem for clang.

This commit is contained in:
Mike Purvis 2013-10-10 17:17:40 -04:00
parent e0967cd3fc
commit bd616be971

View File

@ -76,7 +76,7 @@ normalize(struct timespec* ts) {
/*! Return a timespec which is the sum of two other timespecs. This /*! Return a timespec which is the sum of two other timespecs. This
* operator only makes logical sense when one or both of the arguments * operator only makes logical sense when one or both of the arguments
* represents a duration. */ * represents a duration. */
static inline struct timespec static inline timespec
operator+ (const struct timespec &a, const struct timespec &b) { operator+ (const struct timespec &a, const struct timespec &b) {
struct timespec result = { a.tv_sec + b.tv_sec, struct timespec result = { a.tv_sec + b.tv_sec,
a.tv_nsec + b.tv_nsec }; a.tv_nsec + b.tv_nsec };
@ -87,7 +87,7 @@ operator+ (const struct timespec &a, const struct timespec &b) {
/*! Return a timespec which is the difference of two other timespecs. /*! Return a timespec which is the difference of two other timespecs.
* This operator only makes logical sense when one or both of the arguments * This operator only makes logical sense when one or both of the arguments
* represents a duration. */ * represents a duration. */
static inline struct timespec static inline timespec
operator- (const struct timespec &a, const struct timespec &b) { operator- (const struct timespec &a, const struct timespec &b) {
struct timespec result = { a.tv_sec - b.tv_sec, struct timespec result = { a.tv_sec - b.tv_sec,
a.tv_nsec - b.tv_nsec }; a.tv_nsec - b.tv_nsec };
@ -100,7 +100,7 @@ operator- (const struct timespec &a, const struct timespec &b) {
* large carries, eg a <1s timespec multiplied by a large enough integer * large carries, eg a <1s timespec multiplied by a large enough integer
* that the result is muliple seconds. Only makes sense when the timespec * that the result is muliple seconds. Only makes sense when the timespec
* argument is a duration. */ * argument is a duration. */
static inline struct timespec static inline timespec
operator* (const struct timespec &ts, const size_t mul) { operator* (const struct timespec &ts, const size_t mul) {
struct timespec result = { ts.tv_sec * mul, struct timespec result = { ts.tv_sec * mul,
ts.tv_nsec * mul }; ts.tv_nsec * mul };