Fix broken qplatformdefs.h for cygwin-g++ platform

This patch corrects several bugs into qplatformdefs.h for cygwin-g++:
- _GNU_SOURCE must be the very first macro to be checked on top of
the file.
- features.h must be the one to be included for activating the needed
functions, so I moved unistd.h near all other standard headers.
- nowadays, CYGWIN supports sys/ipc.h and sys/shm.h by long time.

Change-Id: Ib32df1746f1b5579698921641408d278104ce128
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Carlo Bramini 2025-01-01 16:11:47 +01:00
parent 1582dd5da1
commit dd9ac87532

View File

@ -4,10 +4,6 @@
#ifndef QPLATFORMDEFS_H #ifndef QPLATFORMDEFS_H
#define QPLATFORMDEFS_H #define QPLATFORMDEFS_H
// Get Qt defines/settings
#include "qglobal.h"
// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs // Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
// 1) need to reset default environment if _BSD_SOURCE is defined // 1) need to reset default environment if _BSD_SOURCE is defined
@ -17,11 +13,11 @@
# define _GNU_SOURCE # define _GNU_SOURCE
#endif #endif
#include <unistd.h> #include <features.h>
// Get Qt defines/settings
// We are hot - unistd.h should have turned on the specific APIs we requested #include "qglobal.h"
#include <pthread.h> #include <pthread.h>
#include <dirent.h> #include <dirent.h>
@ -30,17 +26,16 @@
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
// Cygwin does not provide <sys/ipc.h> and <sys/shm.h> because it #include <sys/ipc.h>
// doesn't support SysV IPC or shared memory. See for example: #include <sys/shm.h>
// http://afni.nimh.nih.gov/afni/afniboard/messages/1725.html
#include <sys/time.h> #include <sys/time.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
//#include <qt_windows.h>
#include <netinet/in.h> #include <netinet/in.h>
#define QT_NO_USE_FSEEKO #define QT_NO_USE_FSEEKO