[libc] Use atomic_load to read FILE->lock

FILE->lock is atomic_int and so should be read using atomic_load.
Previously this wasn't reported, but with a new Clang this is
triggering an error because of -Wtautological-unsigned-zero-compare.

Change-Id: I3fe11f4be356a96d688e90614a9498d3c9eba05e
Esse commit está contido em:
Petr Hosek
2017-09-08 20:31:04 -07:00
commit de CQ bot account: commit-bot@chromium.org
commit c67a9eb4d0
4 arquivos alterados com 4 adições e 4 exclusões
+1 -1
Ver Arquivo
@@ -2,7 +2,7 @@
int fgetc(FILE* f) {
int c;
if (f->lock < 0 || !__lockfile(f))
if (atomic_load(&f->lock) < 0 || !__lockfile(f))
return getc_unlocked(f);
c = getc_unlocked(f);
__unlockfile(f);
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
#include "stdio_impl.h"
int fputc(int c, FILE* f) {
if (f->lock < 0 || !__lockfile(f))
if (atomic_load(&f->lock) < 0 || !__lockfile(f))
return putc_unlocked(c, f);
c = putc_unlocked(c, f);
__unlockfile(f);
+1 -1
Ver Arquivo
@@ -2,7 +2,7 @@
int getc(FILE* f) {
int c;
if (f->lock < 0 || !__lockfile(f))
if (atomic_load(&f->lock) < 0 || !__lockfile(f))
return getc_unlocked(f);
c = getc_unlocked(f);
__unlockfile(f);
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
#include "stdio_impl.h"
int putc(int c, FILE* f) {
if (f->lock < 0 || !__lockfile(f))
if (atomic_load(&f->lock) < 0 || !__lockfile(f))
return putc_unlocked(c, f);
c = putc_unlocked(c, f);
__unlockfile(f);