Skip to content
Permalink
Browse files

tprintf: explicitly ignore result of write(2) calls

```
src/vendor/Heap-Layers/utility/tprintf.h:81:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    write(FD, buf, len);
    ^~~~~ ~~~~~~~~~~~~
```
  • Loading branch information...
bpowers committed Oct 18, 2019
1 parent 9872522 commit ab0775178f85921ddb64af18490fefac26b61c28
Showing with 5 additions and 5 deletions.
  1. +5 −5 utility/tprintf.h
@@ -78,30 +78,30 @@ namespace tprintf {
inline void writeval(double n) {
char buf[MAXBUF];
int len = ftoa(buf, n);
write(FD, buf, len);
auto _ __attribute__((unused)) = write(FD, buf, len);
}

inline void writeval(const char * str) {
write(FD, str, strlen(str));
auto _ __attribute__((unused)) = write(FD, str, strlen(str));
}

inline void writeval(const char c) {
char buf[1];
buf[0] = c;
write(FD, buf, 1);
auto _ __attribute__((unused)) = write(FD, buf, 1);
}

inline void writeval(uint64_t n) {
char buf[MAXBUF];
int len = itoa(buf, n);
write(FD, buf, len);
auto _ __attribute__((unused)) = write(FD, buf, len);
}

template <class T>
inline void writeval(T n) {
char buf[MAXBUF];
int len = itoa(buf, n);
write(FD, buf, len);
auto _ __attribute__((unused)) = write(FD, buf, len);
}

inline void tprintf(const char* format) // base function

0 comments on commit ab07751

Please sign in to comment.
You can’t perform that action at this time.