[LLVMbugs] [Bug 11417] New: clang silently ignores #include of non-seekable files

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 21 15:05:48 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11417

             Bug #: 11417
           Summary: clang silently ignores #include of non-seekable files
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider this ... insanity:

  #include "/proc/cpuinfo"

Okay. This file is not a device, but it is a non-seekable file.

nlewycky at ducttape:~$ ls -l /proc/cpuinfo
-r--r--r-- 1 root root 0 2011-11-21 14:59 /proc/cpuinfo
nlewycky at ducttape:~$ file /proc/cpuinfo
/proc/cpuinfo: empty

"file" in this case has the same bug, it uses the stat size *and trusts it*.
The Unix Way is to just open the file for reading if you're going to read it.
The size in stat is an advisory value only.

What happens is that the include produces no tokens at all. By contrast,
#include "/dev/stdin" produces an actual error "Illegal seek" and points to the
#include responsible. I'd like either the contents or a proper error.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list