summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.cpp
diff options
context:
space:
mode:
authorXia Yang <xiay@nvidia.com>2016-01-20 18:34:59 -0800
committerJosh Gao <jmgao@google.com>2016-02-02 17:28:16 -0800
commit6b45d57739772bf4418923e960cc396ad5a0706e (patch)
treeddc09263ab50cb51d5bdd198d04da7f9c71ec4dc /libc/stdio/stdio.cpp
parentfe60bae4b71f9b4d50912f06acac601762e55b73 (diff)
use GNU C89 extern inline semantics for __size_mul_overflow()
__size_mul_overflow generates warning under following compilation envrionment: -OX -D_FORTIFY_SOURCE=2 (X=1, 2, 3) For example: echo '#include <stdio.h>' | \ prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-gcc \ -I bionic/libc/arch-arm/include \ -I bionic/libc/include \ -I bionic/libc/kernel/uapi \ -I bionic/libc/kernel/common \ -I bionic/libc/kernel/uapi/asm-arm \ -I bionic/libm/include \ -I bionic/libm/include/arm \ -I bionic/libc/include \ -Werror \ -O1 \ -D_FORTIFY_SOURCE=2 \ -c \ -x c \ - bionic/libc/include/stdio.h:360:13: error: '__size_mul_overflow' is static but used in inline function 'fread' which is not static [-Werror] if (__size_mul_overflow(size, count, &total)) { ^ C99 - 6.7.4 "An inline definition of a function with external linkage shall not contain a definition of a modifiable object with static storage duration, and shall not contain a reference to an identifier with internal linkage." As standard does not require compiler to determine when it is safe to reference an internal function in an external inline function, but instead delegalizes such reference as a whole, gcc throws a warning for such code under C99 compilation. Warning produced by libc header is inhereted widely and strips the option of using -Werror to track code sanity. Replace static inline specifier with gnu89 extern inline. Latter "is used only for inlining. In no case is the function compiled on its own", which is slightly different from former semantically, but should produce the same result here. Change-Id: I6a3374498e5499d110e54468cf9d0d67d2debbe2
Diffstat (limited to 'libc/stdio/stdio.cpp')
0 files changed, 0 insertions, 0 deletions