Skip to content

Commit

Permalink
Issue #1053 - Second pass remove android defines and build system stuff.
Browse files Browse the repository at this point in the history
Mostly IPC, tools and mozbuild.
  • Loading branch information
wolfbeast committed Apr 1, 2022
1 parent 35e7103 commit ce0cefe
Show file tree
Hide file tree
Showing 47 changed files with 30 additions and 1,056 deletions.
5 changes: 0 additions & 5 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ def FlagsForFile(filename):

flag_list = shlex.split(out.getvalue())

# This flag is added by Fennec for android build and causes ycmd to fail to parse the file.
# Removing this flag is a workaround until ycmd starts to handle this flag properly.
# https://github.com/Valloric/YouCompleteMe/issues/1490
final_flags = [x for x in flag_list if not x.startswith('-march=armv')]

return {
'flags': final_flags,
'do_cache': True
Expand Down
7 changes: 0 additions & 7 deletions config/recurse.mk
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,9 @@ ifeq (.,$(DEPTH))
js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
accessible/xpcom/export: xpcom/xpidl/export

# The widget binding generator code is part of the annotationProcessors.
widget/android/bindings/export: build/annotationProcessors/export

# .xpt generation needs the xpidl lex/yacc files
xpcom/xpidl/export: xpcom/idl-parser/xpidl/export

# The roboextender addon includes a classes.dex containing a test Java addon.
# The test addon must be built first.
mobile/android/tests/browser/robocop/roboextender/tools: mobile/android/tests/javaaddons/tools

ifdef ENABLE_CLANG_PLUGIN
$(filter-out config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
build/clang-plugin/tests/target: build/clang-plugin/target
Expand Down
7 changes: 1 addition & 6 deletions ipc/chromium/src/base/condition_variable_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ConditionVariable::ConditionVariable(Lock* user_lock)
: user_mutex_(user_lock->lock_impl()->os_lock()) {
int rv = 0;
#if !defined(OS_MACOSX) && \
!(defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC))
defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC))
pthread_condattr_t attrs;
rv = pthread_condattr_init(&attrs);
DCHECK_EQ(0, rv);
Expand Down Expand Up @@ -68,12 +68,7 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) {
absolute_time.tv_nsec %= Time::kNanosecondsPerSecond;
DCHECK_GE(absolute_time.tv_sec, now.tv_sec); // Overflow paranoia

#if defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
int rv = pthread_cond_timedwait_monotonic_np(
&condition_, user_mutex_, &absolute_time);
#else
int rv = pthread_cond_timedwait(&condition_, user_mutex_, &absolute_time);
#endif // OS_ANDROID && HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC
#endif // OS_MACOSX

DCHECK(rv == 0 || rv == ETIMEDOUT);
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/file_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class FilePath {
#endif // OS_WIN

// Implement hash function so that we can use FilePaths in hashsets and maps.
#if defined(COMPILER_GCC) && !defined(ANDROID)
#if defined(COMPILER_GCC)
namespace __gnu_cxx {

template<>
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/file_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <io.h>
#endif
#include <stdio.h>
#if defined(ANDROID) || defined(OS_POSIX)
#if defined(OS_POSIX)
#include <unistd.h>
#endif

Expand Down
2 changes: 0 additions & 2 deletions ipc/chromium/src/base/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

#if defined(OS_WIN)
#include <windows.h>
#elif defined(ANDROID)
#include <sys/stat.h>
#elif defined(OS_POSIX)
#include <sys/types.h>
#include <sys/stat.h>
Expand Down
4 changes: 0 additions & 4 deletions ipc/chromium/src/base/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,9 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix,
return false;
tmpdir = tmpdir.Append(kTempFileName);
std::string tmpdir_string = tmpdir.value();
#ifdef ANDROID
char* dtemp = NULL;
#else
// this should be OK since mkdtemp just replaces characters in place
char* buffer = const_cast<char*>(tmpdir_string.c_str());
char* dtemp = mkdtemp(buffer);
#endif
if (!dtemp)
return false;
*new_temp_path = FilePath(dtemp);
Expand Down
24 changes: 2 additions & 22 deletions ipc/chromium/src/base/hash_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,18 @@

#include "base/string16.h"

#if defined(COMPILER_MSVC) || (defined(ANDROID) && defined(_STLP_STD_NAME))
#ifdef COMPILER_MSVC
#if defined(COMPILER_MSVC)
#pragma push_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS")
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#endif

// Suppress -Wshadow warnings from stlport headers.
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wshadow"
# pragma GCC diagnostic ignored "-Wshadow-local"
#endif

#include <hash_map>
#include <hash_set>

#ifdef __GNUC__
# pragma GCC diagnostic pop // -Wshadow-local
# pragma GCC diagnostic pop // -Wshadow
#endif

#ifdef COMPILER_MSVC
#pragma pop_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS")
#endif

namespace base {
#ifdef ANDROID
using _STLP_STD_NAME::hash_map;
using _STLP_STD_NAME::hash_set;
#else
using stdext::hash_map;
using stdext::hash_set;
#endif
}
#elif defined(COMPILER_GCC)
// This is a hack to disable the gcc 4.4 warning about hash_map and hash_set
Expand Down
3 changes: 0 additions & 3 deletions ipc/chromium/src/base/message_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#include "base/message_pump_glib.h"
#endif
#endif
#ifdef ANDROID
#include "base/message_pump_android.h"
#endif
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
#include "TracedTaskCommon.h"
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/message_pump_libevent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifdef OS_SOLARIS
#include <sys/stat.h>
#endif
#if defined(ANDROID) || defined(OS_POSIX)
#if defined(OS_POSIX)
#include <unistd.h>
#endif

Expand Down
4 changes: 0 additions & 4 deletions ipc/chromium/src/base/observer_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
#include "base/basictypes.h"
#include "base/logging.h"

#if defined(ANDROID) && defined(_STLP_STD_NAME)
using _STLP_STD_NAME::find;
#endif

namespace base {

///////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 0 additions & 3 deletions ipc/chromium/src/base/platform_file_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#ifdef ANDROID
#include <linux/stat.h>
#endif

#include "base/logging.h"
#include "base/string_util.h"
Expand Down
9 changes: 1 addition & 8 deletions ipc/chromium/src/base/process_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
return result;
}

#ifdef ANDROID
typedef unsigned long int rlim_t;
#endif

// A class to handle auto-closing of DIR*'s.
class ScopedDIRClose {
public:
Expand All @@ -113,10 +109,7 @@ typedef mozilla::UniquePtr<DIR, ScopedDIRClose> ScopedDIR;
void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
// DANGER: no calls to malloc are allowed from now on:
// http://crbug.com/36678
#if defined(ANDROID)
static const rlim_t kSystemDefaultMaxFds = 1024;
static const char kFDDir[] = "/proc/self/fd";
#elif defined(OS_LINUX) || defined(OS_SOLARIS)
#if defined(OS_LINUX) || defined(OS_SOLARIS)
static const rlim_t kSystemDefaultMaxFds = 8192;
static const char kFDDir[] = "/proc/self/fd";
#elif defined(OS_MACOSX)
Expand Down
34 changes: 0 additions & 34 deletions ipc/chromium/src/base/shared_memory_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,39 +269,6 @@ void SharedMemory::Close(bool unmap_view) {
}
}

#ifdef ANDROID
void SharedMemory::LockOrUnlockCommon(int function) {
DCHECK(mapped_file_ >= 0);
struct flock lockreq;
lockreq.l_type = function;
lockreq.l_whence = SEEK_SET;
lockreq.l_start = 0;
lockreq.l_len = 0;
while (fcntl(mapped_file_, F_SETLKW, &lockreq) < 0) {
if (errno == EINTR) {
continue;
} else if (errno == ENOLCK) {
// temporary kernel resource exaustion
PlatformThread::Sleep(500);
continue;
} else {
NOTREACHED() << "lockf() failed."
<< " function:" << function
<< " fd:" << mapped_file_
<< " errno:" << errno
<< " msg:" << strerror(errno);
}
}
}

void SharedMemory::Lock() {
LockOrUnlockCommon(F_WRLCK);
}

void SharedMemory::Unlock() {
LockOrUnlockCommon(F_UNLCK);
}
#else
void SharedMemory::LockOrUnlockCommon(int function) {
DCHECK(mapped_file_ >= 0);
while (lockf(mapped_file_, function, 0) < 0) {
Expand All @@ -328,7 +295,6 @@ void SharedMemory::Lock() {
void SharedMemory::Unlock() {
LockOrUnlockCommon(F_ULOCK);
}
#endif

SharedMemoryHandle SharedMemory::handle() const {
return FileDescriptor(mapped_file_, false);
Expand Down
6 changes: 0 additions & 6 deletions ipc/chromium/src/base/sys_info_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

#include <errno.h>
#include <string.h>
#ifndef ANDROID
#include <sys/statvfs.h>
#endif
#include <sys/utsname.h>
#include <unistd.h>

Expand Down Expand Up @@ -90,15 +88,11 @@ int64_t SysInfo::AmountOfPhysicalMemory() {

// static
int64_t SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) {
#ifndef ANDROID
struct statvfs stats;
if (statvfs(WideToUTF8(path).c_str(), &stats) != 0) {
return -1;
}
return static_cast<int64_t>(stats.f_bavail) * stats.f_frsize;
#else
return -1;
#endif
}

// static
Expand Down
8 changes: 2 additions & 6 deletions ipc/chromium/src/base/time_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
#include <mach/mach_time.h>
#endif
#include <sys/time.h>
#if defined(ANDROID) && !defined(__LP64__)
#include <time64.h>
#else
#include <time.h>
#endif
#if defined(ANDROID) || defined(OS_POSIX)
#if defined(OS_POSIX)
#include <unistd.h>
#endif

Expand Down Expand Up @@ -72,7 +68,7 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
#endif

time_t seconds;
#if defined(ANDROID) || defined(OS_SOLARIS)
#if defined(OS_SOLARIS)
seconds = mktime(&timestruct);
#else
if (is_local)
Expand Down
4 changes: 2 additions & 2 deletions js/src/ctypes/Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ Library::Create(JSContext* cx, HandleValue path, const JSCTypesCallbacks* callba
return nullptr;

} else {
// Fallback: assume the platform native charset is UTF-8. This is true
// for Mac OS X, Android, and probably Linux.
// Fallback: assume the platform native charset is UTF-8.
// This is true on most flavors of Linux.
size_t nbytes =
GetDeflatedUTF8StringLength(cx, pathStrChars.twoByteChars(), pathStr->length());
if (nbytes == (size_t) -1)
Expand Down
8 changes: 2 additions & 6 deletions js/src/ctypes/libffi/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,14 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
Expand Down Expand Up @@ -1365,7 +1361,7 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -mingw32* | -mingw64* | -linux-gnu* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
Expand Down
6 changes: 0 additions & 6 deletions js/src/jit/PerfSpewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@

#include "vm/MutexIDs.h"

// perf expects its data to be in a file /tmp/perf-PID.map, but for Android
// and B2G the map files are written to /data/local/tmp/perf-PID.map
//
// Except that Android 4.3 no longer allows the browser to write to /data/local/tmp/
// so also try /sdcard/.

#ifndef PERF_SPEW_DIR
# define PERF_SPEW_DIR "/tmp/"
#endif
Expand Down
1 change: 0 additions & 1 deletion js/src/jsutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ AllTheNonBasicVanillaNewAllocations()
{
// posix_memalign and aligned_alloc aren't available on all Linux
// configurations.
// valloc was deprecated in Android 5.0
//char* q;
//posix_memalign((void**)&q, 16, 16);

Expand Down
6 changes: 3 additions & 3 deletions js/src/old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ AC_LANG_CPLUSPLUS
MOZ_CXX11

case "${OS_TARGET}" in
WINNT|Darwin|Android)
WINNT|Darwin)
;;
*)
STL_FLAGS="-I${DIST}/stl_wrappers"
Expand Down Expand Up @@ -1605,11 +1605,11 @@ dnl = Enable jemalloc
dnl ========================================================

case "${OS_TARGET}" in
Android|WINNT|Darwin)
WINNT|Darwin)
MOZ_GLUE_IN_PROGRAM=
;;
*)
dnl On !Android !Windows !OSX, we only want to link executables against mozglue
dnl On !Windows, we only want to link executables against mozglue
MOZ_GLUE_IN_PROGRAM=1
AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
;;
Expand Down
3 changes: 2 additions & 1 deletion js/src/threading/posix/ConditionVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ js::ConditionVariable::wait_for(UniqueLock<Mutex>& lock,

r = pthread_cond_timedwait(ptCond, ptMutex, &abs_ts);
#else
// Our non-clock-supporting platforms, OS X and Android, do support waiting
// Our non-clock-supporting platforms do support waiting
// on a condition variable with a relative timeout.
// XXXMC: This was in use on Android and OSX. Can probably be removed.
r = pthread_cond_timedwait_relative_np(ptCond, ptMutex, &rel_ts);
#endif

Expand Down
3 changes: 1 addition & 2 deletions mfbt/TaggedAnonymousMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// Some Linux kernels -- specifically, newer versions of Android and
// some B2G devices -- have a feature for assigning names to ranges of
// Some Linux kernels have a feature for assigning names to ranges of
// anonymous memory (i.e., memory that doesn't have a "name" in the
// form of an underlying mapped file). These names are reported in
// /proc/<pid>/smaps alongside system-level memory usage information
Expand Down
Loading

0 comments on commit ce0cefe

Please sign in to comment.