Re: Inclusion of sys/types.h

看板DFBSD_bugs作者時間21年前 (2005/01/26 17:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/9 (看更多)
On Wed, 26 Jan 2005 10:05:33 +0100, Jeroen Ruigrok/asmodai wrote: > -On [20050126 09:32], Jeremy Messenger (mezz7@cox.net) wrote: >>I am maintaining for fluxbox-devel in FreeBSD and Jason has reported me >>about that DragonFly can't find the strftime() during the configure check >>that caused the clock disable in Fluxbox. All version of FreeBSD (include >>4.x) don't have any of problem. The code looks like this in the configure: >> >>================================== >>#include <time.h> >>int >>main () >>{ >> >>char * s; >>time_t t = time(NULL); >>size_t x = strftime(s, 5, "%a", localtime(&t)); >> >> >> ; >> return 0; >>} >>================================== >> >>Jason has to add '#include <sys/types.h>' to fix this problem for >>DragonFly, but I am not sure if it's a bug in DragonFly or his system is >>broke. Two folks in IRC (#freebsd-gnome) said that time.h should be good >>enough for this as stated in the manpage in a link. > > It should be and I am not happy with the change Matt made many months ago. > > strftime() should return size_t, not __size_t, regardless if the type > definition ends up being the same anyway. __ prefixed types are supposed to > be either internal ones, reserved ones or other special case types. > > That's why > > #ifdef _BSD_SIZE_T_ > typedef _BSD_SIZE_T_ size_t; > #undef _BSD_SIZE_T_ > #endif > > was present in time.h before Matt ripped it out. > > My suggestion is to put a size_t definition back into time.h and change the > return type back to what it should be per all specifications, i.e. size_t. http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html Looks like you are right, but I didn't read fully and just sloppy read in there (3:30am here ;-)). I guess, you guys know what you can do with the override port for fluxbox-devel in dfports. Jason's orignal patch is here: ===================================== *** configure.badMon Jan 24 23:19:30 2005 --- configureMon Jan 24 23:18:40 2005 *************** *** 20407,20412 **** --- 20407,20413 ---- cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include <sys/types.h> #include <time.h> int main () ===================================== Cheers, Mezz
文章代碼(AID): #11zsEQ00 (DFBSD_bugs)
討論串 (同標題文章)
文章代碼(AID): #11zsEQ00 (DFBSD_bugs)