SEEK_SET, SEEK_CUR and SEEK_END are not visible from unistd.h when using modules.

Originator:matt
Number:rdar://16222529 Date Originated:04/03/2014
Status:Open Resolved:No
Product:Developer Tools Product Version:Version 5.0.2 (5A3005)
Classification:Serious Bug Reproducible:Always
 
Summary:
unistd.h should mean that the defines SEEK_SET, SEEK_CUR and SEEK_END are available for use with lseek(). However, if you turn on modules support in the Objective-C compiler, then they are not available.

Steps to Reproduce:
Run the following:

$ /usr/bin/clang -o - -S -x objective-c -fmodules - <<EOF
#include <unistd.h>

void foo(void);
void foo(void)
{
  if (SEEK_SET);
  if (SEEK_CUR);
  if (SEEK_END);
}
EOF
<stdin>:6:7: error: use of undeclared identifier 'SEEK_SET'
  if (SEEK_SET);
      ^
<stdin>:7:7: error: use of undeclared identifier 'SEEK_CUR'
  if (SEEK_CUR);
      ^
<stdin>:8:7: error: use of undeclared identifier 'SEEK_END'
  if (SEEK_END);
      ^
3 errors generated.


Expected Results:
Compile succeeds.

Actual Results:
Compile fails.

Regression:
Unknown.

Notes:
$ clang -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

$ which clang
/usr/bin/clang

$ uname -a
Darwin mattjgallo-mbp2 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!