refactor: rename PIP_NO_\* to PIP_HAS_\* with inverted logic

All feature flags now use positive naming (enabled by default):
- PIP_HAS_FILESYSTEM, PIP_HAS_THREADS, PIP_HAS_SOCKET
- PIP_HAS_PROCESS, PIP_HAS_DYNLIB, PIP_HAS_FFT, PIP_HAS_SERIAL

Preprocessor guards inverted:
- #ifndef PIP_NO_X → #ifdef PIP_HAS_X
- #ifdef PIP_NO_X → #ifndef PIP_HAS_X

CMake options default ON instead of OFF.
Platform blocks set flags OFF to disable features.

85 files transformed via Python script + 2 manual fixes.
This commit is contained in:
2026-08-11 19:51:42 +03:00
parent 1db0dfea43
commit 077ac9887b
85 changed files with 344 additions and 342 deletions
+2 -2
View File
@@ -23,7 +23,7 @@
# define _WIN32_WINNT 0x0600
#endif
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#include "piconditionvar.h"
#include "piincludes_p.h"
#ifdef WINDOWS
@@ -178,4 +178,4 @@ void PIConditionVariable::notifyAll() {
pthread_cond_broadcast(&PRIVATE->nativeHandle);
#endif
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+4 -4
View File
@@ -29,7 +29,7 @@
#include "pisystemtime.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Condition variable used together with external %PIMutex.
@@ -175,9 +175,9 @@ private:
PRIVATE_DECLARATION(PIP_EXPORT)
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#ifdef PIP_NO_THREADS
#ifndef PIP_HAS_THREADS
class PIConditionVariable {
public:
void wait(PIMutex &) {}
@@ -187,6 +187,6 @@ public:
void notifyOne() {}
void notifyAll() {}
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PICONDITIONVAR_H
+2 -2
View File
@@ -107,7 +107,7 @@
//! \}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#include "pimutex.h"
#include "piincludes_p.h"
@@ -229,4 +229,4 @@ void PIMutex::destroy() {
pthread_mutex_destroy(&(PRIVATE->mutex));
#endif
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+4 -4
View File
@@ -28,7 +28,7 @@
#include "piinit.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Mutex for mutual exclusion between threads.
@@ -94,9 +94,9 @@ private:
bool cond;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#ifdef PIP_NO_THREADS
#ifndef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Dummy mutex for builds without threading support.
@@ -117,6 +117,6 @@ class PIMutexLocker {
public:
PIMutexLocker(PIMutex &, bool = true) {}
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIMUTEX_H
+2 -2
View File
@@ -151,7 +151,7 @@
#include "pireadwritelock.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIReadWriteLock::PIReadWriteLock() {}
@@ -235,4 +235,4 @@ void PIReadWriteLock::unlockRead() {
var.notifyAll();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -98,7 +98,7 @@
#include "pisemaphore.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PISemaphore::PISemaphore(int initial) {
@@ -153,4 +153,4 @@ int PISemaphore::available() const {
return count;
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+6 -6
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "pithread.h"
# include "piincludes_p.h"
@@ -450,7 +450,7 @@ __THREAD_FUNC_RET__ thread_function_once(void * t) {
//! \return \c false если таймаут истёк
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection * __PIThreadCollection::instance() {
return __PIThreadCollection_Initializer__::__instance__;
@@ -516,7 +516,7 @@ __PIThreadCollection_Initializer__::~__PIThreadCollection_Initializer__() {
}
}
# endif // PIP_NO_THREADS
# endif // PIP_HAS_THREADS
PRIVATE_DEFINITION_START(PIThread)
@@ -1003,7 +1003,7 @@ void PIThread::runOnce(PIObject * object, const char * handler, const PIString &
delete t;
return;
}
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection::instance()->startedAuto(t);
CONNECT0(void, t, stopped, __PIThreadCollection::instance(), stoppedAuto);
# endif
@@ -1037,7 +1037,7 @@ void PIThread::runOnce(std::function<void()> func, const PIString & name) {
PIThread * t = new PIThread();
t->setName(name);
t->setSlot(std::move(func));
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection::instance()->startedAuto(t);
CONNECT0(void, t, stopped, __PIThreadCollection::instance(), stoppedAuto);
# endif
@@ -1079,4 +1079,4 @@ bool PIThread::_waitForFinish(PISystemTime max_tm) {
# endif
return false;
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+3 -3
View File
@@ -43,7 +43,7 @@
class PIThread;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIIntrospectionThreads;
class PIP_EXPORT __PIThreadCollection: public PIObject {
@@ -97,7 +97,7 @@ typedef std::function<void(void *)> ThreadFunc;
//! проход без повторяющегося цикла обработки очереди.
class PIP_EXPORT PIThread: public PIObject {
PIOBJECT_SUBCLASS(PIThread, PIObject);
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
friend class PIIntrospectionThreads;
# endif
@@ -338,5 +338,5 @@ private:
void setThreadName();
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITHREAD_H
+2 -2
View File
@@ -19,7 +19,7 @@
#include "pithreadnotifier.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \addtogroup Thread
//! \{
@@ -145,4 +145,4 @@ void PIThreadNotifier::notify() {
m.unlock();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -27,7 +27,7 @@
#include "piconditionvar.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
@@ -64,6 +64,6 @@ private:
PIMutex m;
PIConditionVariable v;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITHREADNOTIFIER_H
+2 -2
View File
@@ -23,7 +23,7 @@
#include "pisysteminfo.h"
#include "pithread.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \addtogroup Thread
@@ -169,4 +169,4 @@ void PIThreadPoolLoop::exec(int index_start, int index_count, std::function<void
exec(index_start, index_count);
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -21,7 +21,7 @@
#include "pisysteminfo.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \addtogroup Thread
//! \{
@@ -239,4 +239,4 @@ void PIThreadPoolWorker::threadFunc(Worker * w) {
w->notifier.notify();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -33,7 +33,7 @@
//! \~\brief
//! \~english Fixed-size pool of worker threads for generic-purpose tasks.
//! \~russian Фиксированный пул рабочих потоков для задач общего назначения.
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIP_EXPORT PIThreadPoolWorker: public PIObject {
PIOBJECT(PIThreadPoolWorker)
@@ -173,7 +173,7 @@ private:
PISet<PIObject *> contexts;
std::atomic_int64_t next_task_id = {0};
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITHREADPOOLWORKER_H
+2 -2
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#include "pitimer.h"
#include "piconditionvar.h"
@@ -316,4 +316,4 @@ void PITimer::stop() {
thread->stop();
event.notifyAll();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -44,7 +44,7 @@
class PIThread;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Periodic timer that emits ticks from an internal worker thread.
@@ -247,5 +247,5 @@ protected:
PIConditionVariable event;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITIMER_H