[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 237420] fopen and some other functions not found if iosfwd
From:       Nicolás Alvarez  <nicolas.alvarez () gmail ! com>
Date:       2010-06-16 2:33:30
Message-ID: 20100616023330.55F1D45986 () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=237420





--- Comment #1 from Nicolás Alvarez <nicolas alvarez gmail com>  2010-06-16 04:33:27 ---
I have a much smaller testcase (smaller if comparing after preprocessing):

#include <features.h>

#define __need_FILE
#include <stdio.h>

#include <stdio.h>
int main() {
    FILE* fp;
    fp = fopen("foo", "rb");
}

This is quite nasty. Some system header (which is being included indirectly by
<iosfwd>) defines __need_FILE and includes <stdio.h>. With that macro set,
stdio.h will behave different from what it normally does, and then #undef
__need_FILE. The second time it's included (with that macro not defined
anymore), it will do its usual work.

I think KDevelop assumes the second include is identical and doesn't re-process
it with __need_FILE unset. If I remove one of the stdio.h #includes, GCC says
fopen isn't declared, which matches KDevelop behavior. And if I replace either
or both of the includes by the full contents of stdio.h, KDevelop finds the
fopen declaration.

My next step is reducing stdio.h itself to create a minimal testcase that
doesn't require any system headers.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic