ide, uppsrc: Main config flags

This commit is contained in:
Mirek Fidler 2025-04-07 10:21:39 +02:00
parent 9a16396f90
commit 9c2102cb8e
19 changed files with 53 additions and 49 deletions

View file

@ -669,7 +669,7 @@ public:
}
void shutdown_local() throw() {
#ifdef flagUSEMALLOC
#ifdef flagUSEMALLOC // disable U++ allocator (MemoryAlloc is malloc, new/delete standard library)
tls_malloc.shutdown();
#else
UPP::MemoryFreeThread();

View file

@ -619,7 +619,7 @@ void AppExit__()
#endif
}
#ifdef flagTURTLE
#ifdef flagTURTLE // Turtle web backend
void Turtle_PutLink(const String& link);

View file

@ -3,13 +3,9 @@
#define UPP_VERSION 0x20250200
#ifndef flagMT
#define flagMT // MT is now always on
#endif
#define _MULTITHREADED
#define MULTITHREADED
#ifdef flagDLL
#ifdef flagDLL // Build .dll
#define flagUSEMALLOC
#define STD_NEWDELETE
#endif
@ -18,7 +14,7 @@
#define _USRDLL
#endif
#ifdef flagHEAPDBG
#ifdef flagHEAPDBG // Activate heap debugging features even in release mode
#define HEAPDBG
#endif
@ -40,7 +36,7 @@
#include "config.h"
#if defined(flagSTD_NEWDELETE) && !defined(STD_NEWDELETE)
#if defined(flagSTD_NEWDELETE) && !defined(STD_NEWDELETE) // Do not use U++ heap for new/delete
#define STD_NEWDELETE
#endif
@ -278,7 +274,7 @@ namespace std {
namespace Upp {
#ifndef flagNODEPRECATED
#ifndef flagNODEPRECATED // Using deprecated features produces error
#define DEPRECATED
#endif
@ -290,7 +286,11 @@ class JsonIO;
#include "Ops.h"
#include "Fn.h"
#if defined(flagNOSIMD) || defined(flagLEGACY_CPU)
#ifdef flagLEGACY_CPU
#define flagNOSIMD
#endif
#if defined(flagNOSIMD) // Disable SIMD (e.g. SSE2, ARM NEON)
#ifdef CPU_SSE2
#undef CPU_SSE2
#endif
@ -441,8 +441,6 @@ typedef void *DLLHANDLE;
DLLHANDLE LoadDll__(UPP::String& fn, const char *const *names, void *const *procs);
void FreeDll__(DLLHANDLE dllhandle);
#ifndef flagNONAMESPACE
using Upp::byte; // Dirty solution to Windows.h typedef byte...
#endif
#endif //CORE_H

View file

@ -1,6 +1,6 @@
// #define MEMORY_SHRINK
#if !defined(flagUSEMALLOC) && !defined(flagSO) && !defined(flagHEAPOVERRIDE)
#if !defined(flagUSEMALLOC) && !defined(flagSO)
#define UPP_HEAP
#endif

View file

@ -133,8 +133,6 @@ void TinyFree(int size, void *ptr)
inline MemoryOptions::MemoryOptions() {}
inline MemoryOptions::~MemoryOptions() {}
#ifndef flagHEAPOVERRIDE
inline void *MemoryAllocPermanent(size_t size) { return malloc(size); }
inline void *MemoryAlloc(size_t size) { return new byte[size]; }
inline void *MemoryAllocSz(size_t &size) { return new byte[size]; }
@ -168,8 +166,6 @@ inline void TinyFree(int, void *ptr) { return MemoryFree(ptr); }
#endif
#endif
dword MemoryGetCurrentSerial();
void MemoryIgnoreNonMainLeaks();

View file

@ -77,7 +77,7 @@ private:
template <class Range>
void Insert_(int ii, const Range& r, bool def);
#ifdef flagIVTEST
#ifdef flagIVTEST // .activate additional diagnostics code for InVector
void Check(int blki, int offset) const;
#endif
public:

View file

@ -308,7 +308,7 @@ void LogStream::_Put(const void *data, dword size)
sTh.Put(*q++);
}
#ifdef flagCHECKINIT
#ifdef flagCHECKINIT // Adds heap check and additional logging INITBLOCKs
void InitBlockBegin__(const char *fn, int line) {
RLOG(fn << " " << line << " init block");

View file

@ -496,7 +496,7 @@ void Thread::Sleep(int msec)
#endif
}
#ifdef flagPROFILEMT
#ifdef flagPROFILEMT // Add code to gather Mutex locking/blocking statistics
MtInspector *MtInspector::Dumi()
{
static MtInspector h(NULL);
@ -652,7 +652,6 @@ void ConditionVariable::Broadcast()
ConditionVariable::ConditionVariable()
{
#ifndef flagTESTXPCV
ONCELOCK {
if(IsWinVista()) {
DllFn(InitializeConditionVariable, "kernel32", "InitializeConditionVariable");
@ -661,7 +660,6 @@ ConditionVariable::ConditionVariable()
DllFn(SleepConditionVariableCS, "kernel32", "SleepConditionVariableCS");
}
}
#endif
if(InitializeConditionVariable)
InitializeConditionVariable(cv);
else

View file

@ -4,10 +4,12 @@
# include <winnls.h>
#endif
#if defined(PLATFORM_POSIX) && defined(COMPILER_GCC) && !defined(PLATFORM_ANDROID) && defined(flagSTACKTRACE)
#ifdef flagSTACKTRACE // On Panic (e.g. failed ASSERT) try to print stack back-trace
#if defined(PLATFORM_POSIX) && defined(COMPILER_GCC) && !defined(PLATFORM_ANDROID)
# include <execinfo.h>
# include <cxxabi.h>
#endif
#endif
namespace Upp {

View file

@ -44,7 +44,7 @@ struct XmlError : public Exc
class XmlParser {
enum {
#ifdef flagTEST_XML // This is for testing purposes only to increase boundary condition frequency
#ifdef flagTEST_XML // .This is for testing purposes only to increase boundary condition frequency
MCHARS = 128,
CHUNK = 256
#else

View file

@ -26,7 +26,7 @@
#undef WINVER
#undef _WIN32_WINNT
#ifdef flagWIN10
#ifdef flagWIN10 // Force _WIN32_WINNT and NTDDI_VERSION to Win10 values
#define _WIN32_WINNT _WIN32_WINNT_WIN10
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN10_19H1
@ -52,7 +52,7 @@
#define PLATFORM_BSD 1
#define PLATFORM_MACOS 1
#define PLATFORM_OSX 1
#ifndef flagUSEMALLOC
#ifndef flagUSEMALLOC // Completely disable U++ heap allocator
#define STD_NEWDELETE
#endif
#else
@ -129,7 +129,7 @@
#endif
#endif
#ifdef flagFlatpak
#ifdef flagFlatpak // Activates features for Flatpak compilation
#define FLATPAK 1
#endif
@ -170,11 +170,6 @@
#define CPU_UNALIGNED
#endif
#ifdef flagCLR
#define flagUSEMALLOC
#define STD_NEWDELETE
#endif
#if __cplusplus >= 201103
#define CPP_11
#endif

View file

@ -269,7 +269,7 @@ String AsString(const MemoryProfile& mem)
return text;
}
#ifdef flagHEAPSTAT
#ifdef flagHEAPSTAT // Produce U++ allocation heap histogram into log
int stat[65536];
int bigstat;

View file

@ -478,7 +478,7 @@ size_t GetMemoryBlockSize_(void *ptr)
#else
#ifdef flagHEAPLOG
#ifdef flagHEAPLOG // log all heap allocations and deallocations
#undef AllocSz

View file

@ -1,5 +1,3 @@
#ifndef flagNOI18N
#ifndef _Core_lng_h_
#define _Core_lng_h_
@ -303,5 +301,3 @@ INITBLOCK_(COMBINE3(LNG_MODULE, LNG_VERB, LNG_VERA))
#undef T_
#endif
#endif

View file

@ -5,7 +5,7 @@
#include <Core/Core.h>
#ifdef flagCFONTS
#ifdef flagCFONTS // Activates custom font system in Draw (font routines in another package)
#define CUSTOM_FONTSYS
#endif

View file

@ -3,7 +3,9 @@
#define LLOG(x) // LOG(x)
#define LTIMING(x) // TIMING(x)
#if !defined(CUSTOM_FONTSYS) && defined(PLATFORM_COCOA) && !defined(flagNOMM)
#if !defined(CUSTOM_FONTSYS) && defined(PLATFORM_COCOA)
#ifndef flagNOMM // Removes ObjectiveC and AppKit dependence in Draw (but disables Fonts)
#define Point NS_Point
#define Rect NS_Rect
@ -357,4 +359,6 @@ void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int chr, Font
};
#endif
#endif

View file

@ -3,7 +3,7 @@
#include <Draw/Draw.h>
#ifdef flagTIMING
#ifdef flagPAINTER_TIMING // .Activate Painter benchmarking code
#define PAINTER_TIMING(x) RTIMING(x)
#else
#define PAINTER_TIMING(x) // RTIMING(x)

View file

@ -35,19 +35,27 @@ void MainConfigDlg::FlagDlg()
PPInfo pp;
pp.SetIncludes(TheIde()->GetCurrentIncludePath() + ";" + GetClangInternalIncludes());
const Workspace& wspc = GetIdeWorkspace();
static Index<String> ignore_flags = {
"DEBUG", "WIN32", "GUI", "DEBUGCODE", "GCC", "GCC32", "CLANG",
"ANDROID", "WIN32", "POSIX", "OSX", "SO",
};
for(int i = 0; i < wspc.GetCount(); i++) { // find package of included file
const Package& pk = wspc.GetPackage(i);
String pk_name = wspc[i];
for(int i = 0; i < pk.file.GetCount(); i++)
if(!pk.file[i].separator || 1)
if(!pk.file[i].separator)
for(auto m : ~pp.GetFileFlags(SourcePath(pk_name, pk.file[i]))) {
String f = m.key;
f.TrimStart("flag");
auto& fl = flags.GetAdd(f);
fl.b.FindAdd(pk_name);
if(m.value.GetCount() > fl.a.GetCount())
fl.a = m.value;
if(ignore_flags.Find(f) < 0) {
auto& fl = flags.GetAdd(f);
fl.b.FindAdd(pk_name);
String comment = m.value;
if(comment.GetCount() > fl.a.GetCount())
fl.a = comment;
}
}
}
@ -68,8 +76,12 @@ void MainConfigDlg::FlagDlg()
cfg.accepts.ColumnWidths("29 140 458 117");
cfg.accepts.EvenRowColor();
cfg.accepts.NoCursor();
for(const auto& f : ~flags)
cfg.accepts.Add(false, f.key, f.value.a, Join(f.value.b.GetKeys(), ", "));
for(int pass = 0; pass < 2; pass++) // second pass for "hidden" flags
for(const auto& f : ~flags)
if((*f.value.a == '.') == pass) {
f.value.a.TrimStart(".");
cfg.accepts.Add(false, f.key, AttrText(f.value.a).Italic(pass), Join(f.value.b.GetKeys(), ", "));
}
cfg.other.SetFilter(FlagFilterM);
cfg.gui <<= false;

View file

@ -1,3 +1,6 @@
#ifdef flagSTATIC_PNG // Forces the use of internal PNG code even if host has libpng.so
#endif // just for mainconfig info
#if defined(flagWIN32) || defined(flagOSX) || defined(flagSTATIC_PNG)
#include <plugin/png/lib/png.h>
#else