From 6d0e9761fe0c438b0a7322018ed04e418465e52c Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 15 Feb 2021 03:00:10 +0300
Subject: [PATCH] replace i386 checks with __i386__
---
include/SDL_stdinc.h | 8 ++++----
src/cpuinfo/SDL_cpuinfo.c | 14 +++++++-------
src/stdlib/SDL_malloc.c | 7 ++++---
src/video/fbcon/SDL_fbvideo.c | 2 +-
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index 0df46478..ae20b9db 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -258,7 +258,7 @@ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
#endif
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
#define SDL_memset4(dst, val, len) \
do { \
int u0, u1, u2; \
@@ -291,7 +291,7 @@ do { \
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
-#elif defined(__GNUC__) && defined(i386)
+#elif defined(__GNUC__) && defined(__i386__)
#define SDL_memcpy(dst, src, len) \
do { \
int u0, u1, u2; \
@@ -323,7 +323,7 @@ extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
-#elif defined(__GNUC__) && defined(i386)
+#elif defined(__GNUC__) && defined(__i386__)
#define SDL_memcpy4(dst, src, len) \
do { \
int ecx, edi, esi; \
@@ -339,7 +339,7 @@ do { \
#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
#endif
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
#define SDL_revcpy(dst, src, len) \
do { \
int u0, u1, u2; \
diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c
index d0edde7e..3f5e1f80 100644
--- a/src/cpuinfo/SDL_cpuinfo.c
+++ b/src/cpuinfo/SDL_cpuinfo.c
@@ -62,7 +62,7 @@ static void illegal_instruction(int sig)
static __inline__ int CPU_haveCPUID(void)
{
int has_CPUID = 0;
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
__asm__ (
" pushfl # Get original EFLAGS \n"
" popl %%eax \n"
@@ -152,7 +152,7 @@ CPUid by definition. But it's nice to be able to prove it. :) */
static __inline__ int CPU_getCPUIDFeatures(void)
{
int features = 0;
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
__asm__ (
" xorl %%eax,%%eax # Set up for CPUID instruction \n"
" pushl %%ebx \n"
@@ -207,7 +207,7 @@ static __inline__ int CPU_getCPUIDFeatures(void)
done:
}
#elif defined(__sun) && (defined(__i386) || defined(__amd64))
- __asm(
+ __asm(
" xorl %eax,%eax \n"
" pushl %ebx \n"
" cpuid \n"
@@ -233,7 +233,7 @@ static __inline__ int CPU_getCPUIDFeatures(void)
static __inline__ int CPU_getCPUIDFeaturesExt(void)
{
int features = 0;
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
__asm__ (
" movl $0x80000000,%%eax # Query for extended functions \n"
" pushl %%ebx \n"
@@ -284,8 +284,8 @@ static __inline__ int CPU_getCPUIDFeaturesExt(void)
mov features,edx
done:
}
-#elif defined(__sun) && ( defined(__i386) || defined(__amd64) )
- __asm (
+#elif defined(__sun) && (defined(__i386) || defined(__amd64))
+ __asm (
" movl $0x80000000,%eax \n"
" pushl %ebx \n"
" cpuid \n"
@@ -302,7 +302,7 @@ static __inline__ int CPU_getCPUIDFeaturesExt(void)
" movl %edx,-8(%rbp) \n"
#endif
"1: \n"
- );
+ );
#endif
return features;
}
diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c
index 6bc47474..ba2a58d9 100644
--- a/src/stdlib/SDL_malloc.c
+++ b/src/stdlib/SDL_malloc.c
@@ -479,6 +479,7 @@ DEFAULT_MMAP_THRESHOLD default: 256K
#define WIN32 1
#endif /* _WIN32 */
#endif /* WIN32 */
+
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -491,7 +492,7 @@ DEFAULT_MMAP_THRESHOLD default: 256K
#define LACKS_STRINGS_H
#define LACKS_SYS_TYPES_H
#define LACKS_ERRNO_H
-#define LACKS_FCNTL_H
+#define LACKS_FCNTL_H
#define MALLOC_FAILURE_ACTION
#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */
#endif /* WIN32 */
@@ -2298,7 +2299,7 @@ static size_t traverse_and_check(mstate m);
#define treebin_at(M,i) (&((M)->treebins[i]))
/* assign tree index for size S to variable I */
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
@@ -2363,7 +2364,7 @@ static size_t traverse_and_check(mstate m);
/* index corresponding to given bit */
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && defined(__i386__)
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c
index 27fccebf..7206a4bb 100644
--- a/src/video/fbcon/SDL_fbvideo.c
+++ b/src/video/fbcon/SDL_fbvideo.c
@@ -50,7 +50,7 @@
/*#define FBCON_DEBUG*/
-#if defined(i386) && defined(FB_TYPE_VGA_PLANES)
+#if defined(__i386__) && defined(FB_TYPE_VGA_PLANES)
#define VGA16_FBCON_SUPPORT
#include <sys/io.h> /* For ioperm() */
#ifndef FB_AUX_VGA_PLANES_VGA4