[KinoSearch] c99

Eric Howe eric at pieinsky.ca
Fri Jan 15 08:49:55 PST 2010


S_IFDIR comes from stat.h, right? Is there some sort of _POSIX_SOURCE, _BSD_SOURCE, _XOPEN_SOURCE, ... macro magic needed to make things behave? I used to have to play around with various combinations of defining and undefining various *_SOURCE flags back in my portable C days, different combinations for different systems of course. This problem smells like GCC is being stricter than we want it to be and it needs to be told to loosen up.

Just a wild guess.


On 2010-01-14, at 20:59 , Peter Karman wrote:

> marvin at apache.org wrote on 1/14/10 5:53 PM:
>> Author: marvin
>> Date: Thu Jan 14 23:53:22 2010
>> New Revision: 899480
>> 
>> URL: http://svn.apache.org/viewvc?rev=899480&view=rev
>> Log:
>> Always build under C99 with GCC.
> 
> 
> *sigh*
> 
> perhaps this was premature on my part. Now I'm getting failures to compile under 
> Linux, CentOS 5 32bit and RHEL 4 64bit both tested, with gcc 4.1.2 and 3.4.6. 
> With -std=c99 I get errors like:
> 
> ../core/KinoSearch/Store/FSFolder.c: In function ‘S_dir_ok’:
> ../core/KinoSearch/Store/FSFolder.c:292: error: ‘S_IFDIR’ undeclared (first use 
> in this function)
> 
> and
> 
> ../core/KinoSearch/Store/FSDirHandle.c: In function ‘kino_FSDH_entry_is_dir’:
> ../core/KinoSearch/Store/FSDirHandle.c:104: error: ‘DT_DIR’ undeclared (first 
> use in this function)
> 
> 
> 
> but with no -std=c99 it compiles just fine.
> 
> I googled and poked around the code and am just puzzled. The errors indicate 
> that some .h is not being properly included, but the code itself has #ifdef 
> CHY_HAS_* tests around it, indicating that Charmonizer found the .h just fine. 
> And yes, Charmonizer compiles ok with the -std=c99 option.
> 
> Weird.
> 
> Same holds true for KS 0.30_072 -- I just tried it with -std=c99 and it fails to 
> compile with same error:
> 
> core/KinoSearch/Util/Compat/DirManip.c: In function ‘kino_DirManip_dir_ok’:
> core/KinoSearch/Util/Compat/DirManip.c:36: error: ‘S_IFDIR’ undeclared (first 
> use in this function)
> 
> core/KinoSearch/Util/Compat/DirManip.c: In function ‘SI_entry_is_dir’:
> core/KinoSearch/Util/Compat/DirManip.c:101: error: ‘DT_DIR’ undeclared (first 
> use in this function)
> 
> I tried it with KINO_DEBUG=1 as well under CentOS5 (gcc 4.1.2) which includes 
> -std=c89 and it failed with same error.
> 
> So OS X is happy only with c99 and Linux is happy only without it.
> 
> thoughts?
> -- 
> Peter Karman  .  http://peknet.com/  .  peter at peknet.com
> 
> _______________________________________________
> kinosearch mailing list
> kinosearch at rectangular.com
> http://rectangular.com/cgi-bin/mailman/listinfo/kinosearch


Eric Howe
eric at pieinsky.ca




More information about the kinosearch mailing list