[cfe-dev] query regarding system-header-simulator.h

Jyoti jyoti.yalamanchili at gmail.com
Fri Feb 1 02:44:21 PST 2013

Hi Jordan,
I understand it's overall purpose now. However, need some more clarity. So
does this mean that if system-header-simulator.h is included
in a test file all system function declarations in system headers will be
overridden by those in system-header-simulator.h ?
In effect, i want to know what #pragma clang system_header" means or what
it does?
I know #pragma clang is a directive to clang and it is informing something
about system headers to clang but precisely what is my question.
Does it also mean that it should be possible to compile a test file
invoking system functions by just including system-header-simulator.h
file and not including the system headers directly ?
I did try by including malloc in test file div-zero.cpp and including
system-header-simulator.h instead of stdlib.h, but fails to compile.

Thanks in advance.

On Fri, Feb 1, 2013 at 2:39 PM, Csaba Raduly <rcsaba at gmail.com> wrote:

> On Thu, Jan 31, 2013 at 6:23 PM, Jordan Rose  wrote:
> > Hi, Jyoti. The static analyzer treats some functions differently if they
> > come from a system header -- for example, it is assumed that system
> > functions do not arbitrarily free() their parameters, and that some bugs
> > found in system headers cannot be fixed by the user and should be
> > suppressed. system-header-simulator.h uses "#pragma clang system_header"
> so
> > that this behavior can be tested without relying on the actual headers on
> > your system.
> There ought to be a comment to that effect :)
> Csaba
> --
> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
> The Tao of math: The numbers you can count are not the real numbers.
> Life is complex, with real and imaginary parts.
> "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus
> Torvalds
> "People disagree with me. I just ignore them." -- Linus Torvalds
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130201/813d8554/attachment.html>

More information about the cfe-dev mailing list