[PATCH] D51538: Add glibc_prereq to platform limits mmsghdr

Stephen Hines via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 15:23:20 PDT 2018


srhines added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1044
+
+#if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21) && __GLIBC_PREREQ (2, 14)
 CHECK_TYPE_SIZE(mmsghdr);
----------------
vitalybuka wrote:
> srhines wrote:
> > bcain wrote:
> > > vitalybuka wrote:
> > > > srhines wrote:
> > > > > I think this will break for Android, which doesn't define GLIBC_PREREQ. You need to put this check in with the `!defined(__ANDROID__)` part.
> > > > Please move __GLIBC_PREREQ back, under
> > > > ```
> > > > #if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21)
> > > > ```
> > > Oh, right, I think I understand.  Does this make more sense?
> > > 
> > > ```
> > > #ifndef __GLIBC_PREREQ
> > > #define __GLIBC_PREREQ(x, y) 0
> > > #endif
> > >  
> > > #if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21) && (!defined(__GLIBC__) ||  __GLIBC_PREREQ (2, 14))
> > > CHECK_TYPE_SIZE(mmsghdr);
> > > CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
> > > CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
> > > #endif
> > > ```
> > I think this will work.
> > Please move __GLIBC_PREREQ back, under
> Please ignore request above
> 
> 
> I think this should be 
> ```
> #if SANITIZER_LINUX && (__GLIBC_PREREQ (2, 14) || (defined(__ANDROID__) && __ANDROID_API__ >= 21))
> ```
`defined(__ANDROID__)` is redundant in this case. You can just check for `__ANDROID_API__ >= 21` now.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D51538





More information about the llvm-commits mailing list