[PATCH] D117611: [Sema] Warn about printf %n on Android and Fuchsia

Elliott Hughes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 15:01:54 PST 2022


enh added a comment.

In D117611#3339137 <https://reviews.llvm.org/D117611#3339137>, @glandium wrote:

> This doesn't leave much room to use `__attribute__((format(printf)))` on custom printf implementations that do support `%n` on Android does it?

it would be pretty hard to get into that situation though? apps are clones of the zygote, so you don't have any choice over your libc on Android: it's all bionic, all the time. (our seccomp policies also mean "good luck trying to run a static musl/glibc binary".) clang's Android target already assumes bionic in other ways --- things like whether math functions set errno, or whatever, so this seems in keeping to me.

ah, you don't mean *printf* implementations, you mean "other functions that take printf arguments"? yeah, that's a more interesting case. though that one's already broken: there's already no way to say what subset of printf formats you do/don't support. (all the ones in the Android OS itself are all subsets of the bionic printf; many equal, but several *much* smaller. that would be a pretty cool thing to be able to specify, but that's a much bigger bug, and this change brings us closer to reality than we currently are, for the 99% case :-) )


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117611/new/

https://reviews.llvm.org/D117611



More information about the cfe-commits mailing list