Skip to content

Commit

Permalink
define OS_BSD on *BSD and replace the ifdefs to use that
Browse files Browse the repository at this point in the history
BUG=
TEST=compile


Review URL: http://codereview.chromium.org/8564020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109986 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
robert.nagy@gmail.com committed Nov 15, 2011
1 parent 8d96d62 commit e37e88a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
6 changes: 3 additions & 3 deletions base/debug/debugger_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <AvailabilityMacros.h>
#endif

#if defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_FREEBSD)
#if defined(OS_MACOSX) || defined(OS_BSD)
#include <sys/sysctl.h>
#endif

Expand Down Expand Up @@ -59,7 +59,7 @@ bool SpawnDebuggerOnProcess(unsigned /* process_id */) {
return false;
}

#if defined(OS_MACOSX) || defined(OS_OPENBSD)
#if defined(OS_MACOSX) || defined(OS_BSD)

// Based on Apple's recommended method as described in
// http://developer.apple.com/qa/qa2004/qa1361.html
Expand Down Expand Up @@ -108,7 +108,7 @@ bool BeingDebugged() {

// This process is being debugged if the P_TRACED flag is set.
is_set = true;
#if defined(OS_OPENBSD)
#if defined(OS_BSD)
being_debugged = (info.p_flag & P_TRACED) != 0;
#else
being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
Expand Down
13 changes: 6 additions & 7 deletions base/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ namespace file_util {

namespace {

#if defined(OS_OPENBSD) || defined(OS_FREEBSD) || \
(defined(OS_MACOSX) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
#if defined(OS_BSD) || (defined(OS_MACOSX) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
typedef struct stat stat_wrapper_t;
static int CallStat(const char *path, stat_wrapper_t *sb) {
base::ThreadRestrictions::AssertIOAllowed();
Expand Down Expand Up @@ -158,8 +157,8 @@ int CountFilesCreatedAfter(const FilePath& path,

DIR* dir = opendir(path.value().c_str());
if (dir) {
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
!defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_ANDROID)
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_BSD) && \
!defined(OS_SOLARIS) && !defined(OS_ANDROID)
#error Port warning: depending on the definition of struct dirent, \
additional space for pathname may be needed
#endif
Expand Down Expand Up @@ -801,8 +800,8 @@ bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
if (!dir)
return false;

#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
!defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_ANDROID)
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_BSD) && \
!defined(OS_SOLARIS) && !defined(OS_ANDROID)
#error Port warning: depending on the definition of struct dirent, \
additional space for pathname may be needed
#endif
Expand Down
5 changes: 2 additions & 3 deletions base/platform_file_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

namespace base {

#if defined(OS_OPENBSD) || defined(OS_FREEBSD) || \
(defined(OS_MACOSX) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
#if defined(OS_BSD) || (defined(OS_MACOSX) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
typedef struct stat stat_wrapper_t;
static int CallFstat(int fd, stat_wrapper_t *sb) {
base::ThreadRestrictions::AssertIOAllowed();
Expand Down
2 changes: 1 addition & 1 deletion base/time_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
// FreeBSD 6 has CLOCK_MONOLITHIC but defines _POSIX_MONOTONIC_CLOCK to -1.
#if (defined(OS_POSIX) && \
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \
defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_ANDROID)
defined(OS_BSD) || defined(OS_ANDROID)

// static
TimeTicks TimeTicks::Now() {
Expand Down
16 changes: 11 additions & 5 deletions build/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@
#error Please add support for your platform in build/build_config.h
#endif

#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
defined(OS_SOLARIS)
#define USE_X11 1 // Use X for graphics.
#endif

#if defined(USE_OPENSSL) && defined(USE_NSS)
#error Cannot use both OpenSSL and NSS
#endif

// For access to standard BSD features, use OS_BSD instead of a
// more specific macro.
#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
#define OS_BSD 1
#endif

// For access to standard POSIXish features, use OS_POSIX instead of a
// more specific macro.
#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
Expand All @@ -60,6 +61,11 @@
#define OS_POSIX 1
#endif

#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \
!defined(OS_NACL)
#define USE_X11 1 // Use X for graphics.
#endif

// Use tcmalloc
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
#define USE_TCMALLOC 1
Expand Down

0 comments on commit e37e88a

Please sign in to comment.