On 2009/11/25 17:48:37, pvalchev wrote: > On 2009/11/25 09:26:42, Mikhail Naganov wrote: > > On 2009/11/25 02:55:05, pvalchev wrote: > > > seems to work from a few basic tests > > > > Out of curiosity, I've compared 'platform-openbsd.cc' with > 'platform-freebsd.cc' > > and found only minor differences. I think, a better approach would be to reuse > > the common code for these two platforms as much as possible. > > > > So, my proposal is to rename 'platform-freebsd' to something like > > 'platform-bsd', and throw in #ifdefs where needed.
> I can see where you are coming from, but the freebsd one is basically a > copy of > the linux one with OS-specific modifications too. So you can make the > argument > that there should be only one, with lots of ifdef's - but that's very > ugly and I > like chrome's approach of having different _os.c files. Can you please point out more concretely what '_os.c' files do you mean? In Chromium, I can only find such files in sqlite and native_client. But in Chromium's own code I see lots of "#if defined(OS_LINUX) || defined(OS_FREEBSD)"-like branches. I agree that having such ifdefs is ugly is confusing, it also doesn't scale well: e.g. what will happen if someone will be adding NetBSD or Solaris support? But I also don't have any good example of how to get portability right from the start. Is there any good example of a serious cross-platform project which doesn't use #ifdef's? > There are some significant differences between freebsd and openbsd in this file, > for example the lack of ucontext. Also a lot of the mmap/mprotect magic > will be > different, because OpenBSD has W^X (where no page can be writable and executable > at the same time, as a security measure). The difference between the two > files > may seem minor right now, but that's because several of the openbsd > functions > are UNIMPLEMENTED();, I just wanted to get further before spending > significant > time on flushing out this file, but there is more work to be done. > Did I mention I hate ifdef's? :) But it's up to you guys to decide in the > end. I wouldn't like to be a blocker of adding OpenBSD support. I guess this is for Chromium, right? But if you really have understanding of future changes in your 'platform-openbsd' source, please clean it up and add appropriate comments. Right now it looks like it has been hastily copied and patched from 'platform-freebsd'. http://codereview.chromium.org/431047 --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
