[llvm-bugs] [Bug 46747] New: Lower limit of availability attribute isn't enforced
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 16 05:35:24 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46747
Bug ID: 46747
Summary: Lower limit of availability attribute isn't enforced
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: Malcolm_Ferguson at yahoo.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
The following does not produce an error. I expect it should:
$ cat << EOF | ./clang -x c - -mmacosx-version-min=10.9
__attribute__((availability(macosx,introduced=10.10,deprecated=10.11,obsoleted=10.12)))
int fn(void) { return 1; }
int main() { return fn(); }
EOF
If I set -mmacosx-version-min=10.11, clang issues a warning. If I set it to
10.12, clang issues an error. It handles the upper limit of the availibity
attribute, but not the lower limit.
This was a problem for us compiling Python3 to run on macOS 10.9 using a modern
version of Xcode. The fdopendir() function was added to dirent.h in
MacOSX10.10.sdk and is available on systems running macOS 10.10 or later. The
autoconf script for Python detects that fdopendir is available and uses this
instead of opendir(), but it wouldn't do this if clang issued an error. This
led to runtime fails on the min. supported system. We build all of our
products this way, which means we run the risk of accidentally using functions
that aren't available.
Apple's dirent.h declares:
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
DIR *fdopendir(int) __DARWIN_ALIAS_I(fdopendir);
Which preprocesses to:
# 128
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/dirent.h"
3 4
__attribute__((availability(macosx,introduced=10.10)))
DIR *fdopendir(int) __asm("_" "fdopendir" "$INODE64" );
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200716/06dec018/attachment.html>
More information about the llvm-bugs
mailing list