Issue #1053 - Remove __ANDROID__ defines (except in third party code)

This commit is contained in:
Moonchild 2021-03-21 16:15:54 +00:00 committed by roytam1
commit b8f2ada817
10 changed files with 17 additions and 137 deletions

View file

@ -331,13 +331,6 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate,
cubeb_stream_params params;
params.rate = aRate;
params.channels = mOutChannels;
#if defined(__ANDROID__)
params.stream_type = CUBEB_STREAM_TYPE_MUSIC;
if (params.stream_type == CUBEB_STREAM_TYPE_MAX) {
return NS_ERROR_INVALID_ARG;
}
#endif
params.format = ToCubebFormat<AUDIO_OUTPUT_FORMAT>::value;
mAudioClock.Init(aRate);

View file

@ -630,15 +630,7 @@ AudioCallbackDriver::Init()
mSampleRate = output.rate = CubebUtils::PreferredSampleRate();
#if defined(__ANDROID__)
output.stream_type = CUBEB_STREAM_TYPE_MUSIC;
if (output.stream_type == CUBEB_STREAM_TYPE_MAX) {
NS_WARNING("Bad stream type");
return;
}
#else
(void)mAudioChannel;
#endif
output.channels = mGraphImpl->AudioChannelCount();
if (AUDIO_OUTPUT_FORMAT == AUDIO_FORMAT_S16) {

View file

@ -1,19 +1,20 @@
/*
* Copyright © 2000 SuSE, Inc.
* Copyright © 2007 Red Hat, Inc.
* Copyright © 2021 Moonchild Productions
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* documentation, and that the names of the authors not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* written prior permission. The authors make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHORS
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
@ -94,39 +95,6 @@ detect_cpu_features (void)
return features;
}
#elif defined(__ANDROID__) || defined(ANDROID) /* Android */
static arm_cpu_features_t
detect_cpu_features (void)
{
arm_cpu_features_t features = 0;
char buf[1024];
char* pos;
const char* ver_token = "CPU architecture: ";
FILE* f = fopen("/proc/cpuinfo", "r");
if (!f) {
return features;
}
fread(buf, sizeof(char), sizeof(buf), f);
fclose(f);
pos = strstr(buf, ver_token);
if (pos) {
char vchar = *(pos + strlen(ver_token));
if (vchar >= '0' && vchar <= '9') {
int ver = vchar - '0';
if (ver >= 7)
features |= ARM_V7;
}
}
if (strstr(buf, "neon") != NULL)
features |= ARM_NEON;
if (strstr(buf, "vfp") != NULL)
features |= ARM_VFP;
return features;
}
#elif defined (__linux__) /* linux ELF */
#include <unistd.h>

View file

@ -1,19 +1,20 @@
/*
* Copyright © 2000 SuSE, Inc.
* Copyright © 2007 Red Hat, Inc.
* Copyright © 2021 Moonchild Productions
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* documentation, and that the names of the authors not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* written prior permission. The authors make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHORS
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
@ -290,7 +291,7 @@ pixman_have_arm_iwmmxt (void)
#endif
}
#elif defined (__linux__) || defined(__ANDROID__) || defined(ANDROID) /* linux ELF or ANDROID */
#elif defined (__linux__) /* linux ELF */
static pixman_bool_t arm_has_v7 = FALSE;
static pixman_bool_t arm_has_v6 = FALSE;
@ -299,39 +300,6 @@ static pixman_bool_t arm_has_neon = FALSE;
static pixman_bool_t arm_has_iwmmxt = FALSE;
static pixman_bool_t arm_tests_initialized = FALSE;
#if defined(__ANDROID__) || defined(ANDROID) /* Android device support */
static void
pixman_arm_read_auxv_or_cpu_features ()
{
char buf[1024];
char* pos;
const char* ver_token = "CPU architecture: ";
FILE* f = fopen("/proc/cpuinfo", "r");
if (!f) {
arm_tests_initialized = TRUE;
return;
}
fread(buf, sizeof(char), sizeof(buf), f);
fclose(f);
pos = strstr(buf, ver_token);
if (pos) {
char vchar = *(pos + strlen(ver_token));
if (vchar >= '0' && vchar <= '9') {
int ver = vchar - '0';
arm_has_v7 = ver >= 7;
arm_has_v6 = ver >= 6;
}
}
arm_has_neon = strstr(buf, "neon") != NULL;
arm_has_vfp = strstr(buf, "vfp") != NULL;
arm_has_iwmmxt = strstr(buf, "iwmmxt") != NULL;
arm_tests_initialized = TRUE;
}
#elif defined (__linux__) /* linux ELF */
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -382,8 +350,6 @@ pixman_arm_read_auxv_or_cpu_features ()
arm_tests_initialized = TRUE;
}
#endif /* Linux elf */
#if defined(USE_ARM_SIMD)
pixman_bool_t
pixman_have_arm_simd (void)
@ -420,7 +386,7 @@ pixman_have_arm_iwmmxt (void)
#endif /* USE_ARM_IWMMXT */
#else /* !_MSC_VER && !Linux elf && !Android */
#else /* !_MSC_VER && !Linux elf */
#define pixman_have_arm_simd() FALSE
#define pixman_have_arm_neon() FALSE

View file

@ -1,6 +1,7 @@
/*
* Copyright © 2007,2008,2009 Red Hat, Inc.
* Copyright © 2011,2012 Google, Inc.
* Copyright © 2021 Moonchild Productions
*
* This is part of HarfBuzz, a text shaping library.
*
@ -24,6 +25,7 @@
*
* Red Hat Author(s): Behdad Esfahbod
* Google Author(s): Behdad Esfahbod
* Moonchild Productions Author(s): Moonchild Straver
*/
#ifndef HB_PRIVATE_HH
@ -202,13 +204,6 @@ static int errno = 0; /* Use something better? */
* mingw32 headers say atexit is safe to use in shared libraries.
*/
# define HB_USE_ATEXIT 1
# elif defined(__ANDROID__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
/* This was fixed in Android NKD r8 or r8b:
* https://code.google.com/p/android/issues/detail?id=6455
* which introduced GCC 4.6:
* https://developer.android.com/tools/sdk/ndk/index.html
*/
# define HB_USE_ATEXIT 1
# endif
#endif

View file

@ -30,8 +30,6 @@
#ifndef JIT_SPEW_DIR
# if defined(_WIN32)
# define JIT_SPEW_DIR ""
# elif defined(__ANDROID__)
# define JIT_SPEW_DIR "/data/local/tmp/"
# else
# define JIT_SPEW_DIR "/tmp/"
# endif

View file

@ -28,12 +28,7 @@
// so also try /sdcard/.
#ifndef PERF_SPEW_DIR
# if defined(__ANDROID__)
# define PERF_SPEW_DIR "/data/local/tmp/"
# define PERF_SPEW_DIR_2 "/sdcard/"
# else
# define PERF_SPEW_DIR "/tmp/"
# endif
#endif
using namespace js;
@ -104,12 +99,6 @@ js::jit::CheckPerf() {
return;
}
#if defined(__ANDROID__)
if (openPerfMap(PERF_SPEW_DIR_2)) {
PerfChecked = true;
return;
}
#endif
fprintf(stderr, "Failed to open perf map file. Disabling IONPERF.\n");
PerfMode = PERF_MODE_NONE;
}

View file

@ -22,9 +22,8 @@ using mozilla::TimeStamp;
static const long NanoSecPerSec = 1000000000;
// Android 32-bit & macOS 10.12 has the clock functions, but not pthread_condattr_setclock.
#if defined(HAVE_CLOCK_MONOTONIC) && \
!(defined(__ANDROID__) && !defined(__LP64__)) && !defined(__APPLE__)
// MacOS 10.12 has the clock functions, but not pthread_condattr_setclock.
#if defined(HAVE_CLOCK_MONOTONIC) && !defined(__APPLE__)
# define USE_CLOCK_API
#endif

View file

@ -34,16 +34,6 @@
# define SPS_ARCH_amd64 1
# define SPS_OS_linux 1
#elif defined(__ANDROID__) && defined(__arm__)
# define SPS_PLAT_arm_android 1
# define SPS_ARCH_arm 1
# define SPS_OS_android 1
#elif defined(__ANDROID__) && defined(__i386__)
# define SPS_PLAT_x86_android 1
# define SPS_ARCH_x86 1
# define SPS_OS_android 1
#elif defined(__linux__) && defined(__i386__)
# define SPS_PLAT_x86_linux 1
# define SPS_ARCH_x86 1

View file

@ -30,21 +30,11 @@
# define LUL_ARCH_x64 1
# define LUL_OS_linux 1
#elif defined(__linux__) && defined(__i386__) && !defined(__ANDROID__)
#elif defined(__linux__) && defined(__i386__)
# define LUL_PLAT_x86_linux 1
# define LUL_ARCH_x86 1
# define LUL_OS_linux 1
#elif defined(__ANDROID__) && defined(__arm__)
# define LUL_PLAT_arm_android 1
# define LUL_ARCH_arm 1
# define LUL_OS_android 1
#elif defined(__ANDROID__) && defined(__i386__)
# define LUL_PLAT_x86_android 1
# define LUL_ARCH_x86 1
# define LUL_OS_android 1
#else
# error "Unsupported platform"
#endif