Added #if defined(__unix__) in the appropriate places to allow for the code to compile for FreeBSD 12.2 using the clang 10.0.1 compiler. (#305)

This commit is contained in:
mjbudd77 2021-01-16 14:40:28 -05:00 committed by GitHub
parent 6d541c6d62
commit 1454238f1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 21 deletions

View File

@ -1,6 +1,6 @@
// GameApp.cpp
//
#ifdef __linux__
#if defined(__linux__) || defined(__unix__)
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
@ -1922,7 +1922,7 @@ void consoleWin_t::openMsgLogWin(void)
int consoleWin_t::setNicePriority( int value )
{
int ret = 0;
#if defined(__linux__)
#if defined(__linux__) || defined(__unix__)
if ( value < -20 )
{
@ -1989,7 +1989,7 @@ int consoleWin_t::getSchedParam( int &policy, int &priority )
{
int ret = 0;
#if defined(__linux__)
#if defined(__linux__) || defined(__unix__)
struct sched_param p;
policy = sched_getscheduler( getpid() );
@ -2025,7 +2025,7 @@ int consoleWin_t::getSchedParam( int &policy, int &priority )
int consoleWin_t::setSchedParam( int policy, int priority )
{
int ret = 0;
#if defined(__linux__)
#if defined(__linux__) || defined(__unix__)
struct sched_param p;
int minPrio, maxPrio;
@ -2131,13 +2131,13 @@ void consoleWin_t::updatePeriodic(void)
emulatorThread_t::emulatorThread_t(void)
{
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
pself = 0;
#endif
}
#ifdef __linux__
#if defined(__linux__)
#ifndef SYS_gettid
#error "SYS_gettid unavailable on this system"
#endif
@ -2150,7 +2150,7 @@ void emulatorThread_t::init(void)
{
int opt;
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
if ( pthread_self() == (pthread_t)QThread::currentThreadId() )
{
pself = pthread_self();
@ -2160,7 +2160,7 @@ void emulatorThread_t::init(void)
#if defined(__linux__)
pid = gettid();
#elif defined(__APPLE__)
#elif defined(__APPLE__) || defined(__unix__)
pid = getpid();
#endif
@ -2193,7 +2193,7 @@ void emulatorThread_t::setPriority( QThread::Priority priority_req )
int emulatorThread_t::setNicePriority( int value )
{
int ret = 0;
#if defined(__linux__)
#if defined(__linux__) || defined(__unix__)
if ( value < -20 )
{
@ -2273,7 +2273,7 @@ int emulatorThread_t::getSchedParam( int &policy, int &priority )
int emulatorThread_t::setSchedParam( int policy, int priority )
{
int ret = 0;
#if defined(__linux__)
#if defined(__linux__) || defined(__unix__)
struct sched_param p;
int minPrio, maxPrio;

View File

@ -36,7 +36,7 @@ class emulatorThread_t : public QThread
void setPriority( QThread::Priority priority );
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
int setSchedParam( int policy, int priority );
int getSchedParam( int &policy, int &priority );
int setNicePriority( int value );
@ -47,7 +47,7 @@ class emulatorThread_t : public QThread
private:
void init(void);
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
pthread_t pself;
int pid;
#endif
@ -77,7 +77,7 @@ class consoleWin_t : public QMainWindow
int showListSelectDialog( const char *title, std::vector <std::string> &l );
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
int setSchedParam( int policy, int priority );
int getSchedParam( int &policy, int &priority );
int setNicePriority( int value );

View File

@ -2168,7 +2168,7 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
{ // Edit Area is ASCII
key = (uchar)event->text()[0].toLatin1();
if ( ::isascii( key ) )
if ( isascii( key ) )
{
int offs = (cursorPosX-32);
int addr = 16*(lineOffset+cursorPosY) + offs;

View File

@ -213,7 +213,7 @@ int LoadGame(const char *path, bool silent)
CloseGame();
}
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
// Resolve absolute path to file
if ( realpath( path, fullpath ) == NULL )
@ -795,7 +795,7 @@ int fceuWrapperInit( int argc, char *argv[] )
g_config->setOption("SDL.LuaScript", "");
if (s != "")
{
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
// Resolve absolute path to file
char fullpath[2048];

View File

@ -4,7 +4,7 @@
#include "Qt/sdl.h"
#include "Qt/throttle.h"
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
#include <time.h>
#endif
@ -32,7 +32,7 @@ bool MaxSpeed = false;
double getHighPrecTimeStamp(void)
{
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
struct timespec ts;
double t;
@ -212,7 +212,7 @@ RefreshThrottleFPS(void)
int highPrecSleep( double timeSeconds )
{
int ret = 0;
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
struct timespec req, rem;
req.tv_sec = (long)timeSeconds;

View File

@ -1,4 +1,4 @@
#ifdef __linux
#if defined(__linux__) || defined(__unix__)
#include <stdlib.h>
#include <unistd.h>
#define SetCurrentDir chdir
@ -6206,7 +6206,7 @@ void FCEU_LuaFrameBoundary()
FCEU_LuaOnStop();
}
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__unix__)
if (exitScheduled)
{ // This function does not exit immediately,
// it requests for the application to exit when next convenient.