various cleanups

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-11-14 23:37:17 +00:00
parent 7cef4e3b2e
commit 9a0b32268f
6 changed files with 6 additions and 202 deletions

View file

@ -52,174 +52,12 @@
#include <qsocketnotifier.h> #include <qsocketnotifier.h>
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#if defined(Q_OS_LINUX)
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#endif
#if defined(QT_NO_INOTIFY)
#include <linux/types.h>
#if defined(__i386__)
# define __NR_inotify_init 291
# define __NR_inotify_add_watch 292
# define __NR_inotify_rm_watch 293
# define __NR_inotify_init1 332
#elif defined(__x86_64__)
# define __NR_inotify_init 253
# define __NR_inotify_add_watch 254
# define __NR_inotify_rm_watch 255
# define __NR_inotify_init1 294
#elif defined(__powerpc__) || defined(__powerpc64__)
# define __NR_inotify_init 275
# define __NR_inotify_add_watch 276
# define __NR_inotify_rm_watch 277
# define __NR_inotify_init1 318
#elif defined (__ia64__)
# define __NR_inotify_init 1277
# define __NR_inotify_add_watch 1278
# define __NR_inotify_rm_watch 1279
# define __NR_inotify_init1 1318
#elif defined (__s390__) || defined (__s390x__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
# define __NR_inotify_init1 324
#elif defined (__alpha__)
# define __NR_inotify_init 444
# define __NR_inotify_add_watch 445
# define __NR_inotify_rm_watch 446
// no inotify_init1 for the Alpha
#elif defined (__sparc__) || defined (__sparc64__)
# define __NR_inotify_init 151
# define __NR_inotify_add_watch 152
# define __NR_inotify_rm_watch 156
# define __NR_inotify_init1 322
#elif defined (__arm__)
# define __NR_inotify_init 316
# define __NR_inotify_add_watch 317
# define __NR_inotify_rm_watch 318
# define __NR_inotify_init1 360
#elif defined (__sh__)
# define __NR_inotify_init 290
# define __NR_inotify_add_watch 291
# define __NR_inotify_rm_watch 292
# define __NR_inotify_init1 332
#elif defined (__sh64__)
# define __NR_inotify_init 318
# define __NR_inotify_add_watch 319
# define __NR_inotify_rm_watch 320
# define __NR_inotify_init1 360
#elif defined (__mips__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
# define __NR_inotify_init1 329
#elif defined (__hppa__)
# define __NR_inotify_init 269
# define __NR_inotify_add_watch 270
# define __NR_inotify_rm_watch 271
# define __NR_inotify_init1 314
#elif defined (__avr32__)
# define __NR_inotify_init 240
# define __NR_inotify_add_watch 241
# define __NR_inotify_rm_watch 242
// no inotify_init1 for AVR32
#elif defined (__mc68000__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
# define __NR_inotify_init1 328
#elif defined (__aarch64__)
# define __NR_inotify_init1 26
# define __NR_inotify_add_watch 27
# define __NR_inotify_rm_watch 28
// no inotify_init for aarch64
#else
# error "This architecture is not supported. Please talk to qt-bugs@trolltech.com"
#endif
#if !defined(IN_CLOEXEC) && defined(O_CLOEXEC) && defined(__NR_inotify_init1)
# define IN_CLOEXEC O_CLOEXEC
#endif
QT_BEGIN_NAMESPACE
#ifdef QT_LINUXBASE
// ### the LSB doesn't standardize syscall, need to wait until glib2.4 is standardized
static inline int syscall(...) { return -1; }
#endif
static inline int inotify_init()
{
#ifdef __NR_inotify_init
return syscall(__NR_inotify_init);
#else
return syscall(__NR_inotify_init1, 0);
#endif
}
static inline int inotify_add_watch(int fd, const char *name, __u32 mask)
{
return syscall(__NR_inotify_add_watch, fd, name, mask);
}
static inline int inotify_rm_watch(int fd, __u32 wd)
{
return syscall(__NR_inotify_rm_watch, fd, wd);
}
#ifdef IN_CLOEXEC
static inline int inotify_init1(int flags)
{
return syscall(__NR_inotify_init1, flags);
}
#endif
// the following struct and values are documented in linux/inotify.h
extern "C" {
struct inotify_event {
__s32 wd;
__u32 mask;
__u32 cookie;
__u32 len;
char name[0];
};
#define IN_ACCESS 0x00000001
#define IN_MODIFY 0x00000002
#define IN_ATTRIB 0x00000004
#define IN_CLOSE_WRITE 0x00000008
#define IN_CLOSE_NOWRITE 0x00000010
#define IN_OPEN 0x00000020
#define IN_MOVED_FROM 0x00000040
#define IN_MOVED_TO 0x00000080
#define IN_CREATE 0x00000100
#define IN_DELETE 0x00000200
#define IN_DELETE_SELF 0x00000400
#define IN_MOVE_SELF 0x00000800
#define IN_UNMOUNT 0x00002000
#define IN_Q_OVERFLOW 0x00004000
#define IN_IGNORED 0x00008000
#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO)
}
QT_END_NAMESPACE
// --------- inotify.h end ----------
#else /* QT_NO_INOTIFY */
#include <sys/inotify.h> #include <sys/inotify.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create() QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create()

View file

@ -42,22 +42,13 @@
#include "qcore_unix_p.h" #include "qcore_unix_p.h"
#include "qelapsedtimer.h" #include "qelapsedtimer.h"
#ifdef Q_OS_NACL #if !defined(Q_OS_HPUX) || defined(QT_ARCH_IA64)
#elif !defined (Q_OS_VXWORKS) # include <sys/select.h>
# if !defined(Q_OS_HPUX) || defined(__ia64)
# include <sys/select.h>
# endif
# include <sys/time.h>
#else
# include <selectLib.h>
#endif #endif
#include <sys/time.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef Q_OS_MAC
#include <mach/mach_time.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static inline bool time_update(struct timeval *tv, const struct timeval &start, static inline bool time_update(struct timeval *tv, const struct timeval &start,

View file

@ -176,7 +176,6 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07
#undef QT_OPEN #undef QT_OPEN
#define QT_OPEN qt_safe_open #define QT_OPEN qt_safe_open
#ifndef Q_OS_VXWORKS // no POSIX pipes in VxWorks
// don't call ::pipe // don't call ::pipe
// call qt_safe_pipe // call qt_safe_pipe
static inline int qt_safe_pipe(int pipefd[2], int flags = 0) static inline int qt_safe_pipe(int pipefd[2], int flags = 0)
@ -212,8 +211,6 @@ static inline int qt_safe_pipe(int pipefd[2], int flags = 0)
return 0; return 0;
} }
#endif // Q_OS_VXWORKS
// don't call dup or fcntl(F_DUPFD) // don't call dup or fcntl(F_DUPFD)
static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC) static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC)
{ {
@ -294,9 +291,6 @@ static inline int qt_safe_close(int fd)
#undef QT_CLOSE #undef QT_CLOSE
#define QT_CLOSE qt_safe_close #define QT_CLOSE qt_safe_close
// - Open C does not (yet?) implement these on Symbian OS
// - VxWorks doesn't have processes
#if !defined(Q_OS_VXWORKS)
static inline int qt_safe_execve(const char *filename, char *const argv[], static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[]) char *const envp[])
{ {
@ -318,9 +312,7 @@ static inline int qt_safe_execvp(const char *file, char *const argv[])
EINTR_LOOP(ret, ::execvp(file, argv)); EINTR_LOOP(ret, ::execvp(file, argv));
return ret; return ret;
} }
#endif
#ifndef Q_OS_VXWORKS // no processes on VxWorks
static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
{ {
int ret; int ret;
@ -328,8 +320,6 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
return ret; return ret;
} }
#endif // Q_OS_VXWORKS
#if !defined(_POSIX_MONOTONIC_CLOCK) #if !defined(_POSIX_MONOTONIC_CLOCK)
# define _POSIX_MONOTONIC_CLOCK -1 # define _POSIX_MONOTONIC_CLOCK -1
#endif #endif

View file

@ -523,7 +523,7 @@ bool QLibrary::isLibrary(const QString &fileName)
the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix." the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix."
*/ */
validSuffixList << QLatin1String("sl"); validSuffixList << QLatin1String("sl");
# if defined __ia64 # if defined QT_ARCH_IA64
validSuffixList << QLatin1String("so"); validSuffixList << QLatin1String("so");
# endif # endif
# elif defined(Q_OS_AIX) # elif defined(Q_OS_AIX)
@ -605,21 +605,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
.arg((QT_VERSION & 0xff00) >> 8) .arg((QT_VERSION & 0xff00) >> 8)
.arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false")) .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false"))
.arg(fileName); .arg(fileName);
#ifdef Q_WS_MAC
// On Mac, add the application arch to the reg key in order to
// cache plugin information separately for each arch. This prevents
// Qt from wrongly caching plugin load failures when the archs
// don't match.
#if defined(__x86_64__)
regkey += QLatin1String("-x86_64");
#elif defined(__i386__)
regkey += QLatin1String("-i386");
#elif defined(__ppc64__)
regkey += QLatin1String("-ppc64");
#elif defined(__ppc__)
regkey += QLatin1String("-ppc");
#endif
#endif // Q_WS_MAC
QStringList reg; QStringList reg;
#ifndef QT_NO_SETTINGS #ifndef QT_NO_SETTINGS

View file

@ -106,7 +106,7 @@ bool QLibraryPrivate::load_sys()
// But since we don't know if we are built on HPUX or HPUXi, // But since we don't know if we are built on HPUX or HPUXi,
// we support both .sl (and .<version>) and .so suffixes but // we support both .sl (and .<version>) and .so suffixes but
// .so is preferred. // .so is preferred.
# if defined(__ia64) # if defined(QT_ARCH_IA64)
if (!fullVersion.isEmpty()) { if (!fullVersion.isEmpty()) {
suffixes << QString::fromLatin1(".so.%1").arg(fullVersion); suffixes << QString::fromLatin1(".so.%1").arg(fullVersion);
} else { } else {

View file

@ -348,7 +348,7 @@ Q_INLINE_TEMPLATE void QList<T>::node_construct(Node *n, const T &t)
{ {
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t); if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t);
else if (QTypeInfo<T>::isComplex) new (n) T(t); else if (QTypeInfo<T>::isComplex) new (n) T(t);
#if (defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__IBMCPP__)) && !defined(__OPTIMIZE__) #if (defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(__IBMCPP__)) && !defined(__OPTIMIZE__)
// This violates pointer aliasing rules, but it is known to be safe (and silent) // This violates pointer aliasing rules, but it is known to be safe (and silent)
// in unoptimized GCC builds (-fno-strict-aliasing). The other compilers which // in unoptimized GCC builds (-fno-strict-aliasing). The other compilers which
// set the same define are assumed to be safe. // set the same define are assumed to be safe.