Commit Graph

107 Commits

Author SHA1 Message Date
Markus Reitböck
f0eca551b3 Base: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:01 +02:00
wmayer
753130de56 Base: Remove weird error parameter from encode 2025-06-04 14:14:20 +02:00
wmayer
7358ef9b9f Base: Allow to also throw exception by given Python type 2025-06-04 14:14:20 +02:00
Andrea
f8b327fffc Removed empty functions
Removed empty functions
2025-05-19 18:25:17 +02:00
bofdahof
998f4e4d45 Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Ladislav Michl
c293d74566 Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
bofdahof
838178bb1c Base: simplify Exception
Remove repetition. Add functions to replace macros, but keep macros
in use for now as some compilers have broken std::source_location
support.
2025-05-05 23:50:01 +02:00
Chris Hennes
f0fc6ccde1 Base: Remove deprecated Py_GetPath call
Replace it with a piece of code that replicates the functionality. Also eliminate the round-trip through char * that this function was using (the final variable is stored as a std::string anyway).
2025-03-22 18:59:05 -05:00
mos
c70a7933e6 Removed old Python code <3.10 2025-03-07 16:34:08 -06:00
tritao
3b47599e43 Gui: Minor cleanups. 2025-02-05 22:13:07 +00:00
Chris Hennes
7c7b6ce146 Base: Support virtual environment in Py>=3.11 2024-06-10 11:26:09 -05:00
wmayer
655d5e4fbd Base: enable user site-packages for Py >= 3.11
For more details see: https://forum.freecad.org/viewtopic.php?p=748296#p748296
2024-03-20 19:24:45 +01:00
Ladislav Michl
1215301e59 Base: Fix #12061
While rebasing after f539138dd9 ("fix readability-*:") a mistake was
make, causing  exception been thrown for every file opened. While there,
invert file test existence logic, so we return early on failure.

Fixes: 95b37fa806 ("Base: Do not use else before return")
2024-02-26 17:39:33 +01:00
Ladislav Michl
95b37fa806 Base: Do not use else before return 2024-01-21 16:14:12 +01:00
wmayer
08b10cd287 fix cppcoreguidelines-*
* cppcoreguidelines-init-variables
* cppcoreguidelines-c-copy-assignment-signature
* cppcoreguidelines-macro-usage
* cppcoreguidelines-non-private-member-variables-in-classes
* cppcoreguidelines-pro-type-member-init
* cppcoreguidelines-slicing
* cppcoreguidelines-special-member-functions
* cppcoreguidelines-virtual-class-destructor
2023-11-16 01:22:09 +01:00
wmayer
7c00932fa0 fix readability-isolate-declarations 2023-11-16 01:22:08 +01:00
wmayer
f539138dd9 fix readability-*:
* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
2023-11-16 01:22:08 +01:00
wmayer
73a1e90e45 fix readability-identifier-length 2023-11-16 01:22:08 +01:00
wmayer
e85c383bff Base: apply clang format 2023-11-13 12:01:26 -05:00
wmayer
0a9f664f46 Base: fix crash in PyException::ReportException() 2023-11-06 10:08:18 +01:00
Ed Williams
792af641db Base: set sys.last_vars to enable post mortem debugging after exception
* Update Interpreter.cpp to enable stack trace

This enables python debuggers to stack trace after an exception.
See https://forum.freecad.org/viewtopic.php?p=714349#p714349

Co-authored-by: bdieterm <119257544+bdieterm@users.noreply.github.com>
2023-10-31 09:40:57 +01:00
mosfet80
d453672ab8 [BASE] Removed dead code (#10330) 2023-08-28 10:41:20 -05:00
wmayer
010dca8303 Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
wmayer
5f0ec490e6 Core: modernize C++: return braced init list 2023-08-19 11:35:41 +02:00
wmayer
2bc90e6090 Base: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
wmayer
c7a17468e7 modernize C++: use noexcept 2023-08-07 16:06:58 +02:00
Abdullah Tahiri
1307f708c7 Interpreter: Fix lack of notifier in DeveloperError call 2023-06-01 19:25:00 +02:00
Abdullah Tahiri
c2b2b0c1fa Base: Interpreter - Mark Exception reporting and stack as intended for developers 2023-05-23 14:24:45 +02:00
wmayer
c7a21ecbee Fixes #8206: FreeCAD segfaults being run with parameters (e.g .desktop file has /usr/bin/freecad --single-instance) 2023-02-11 17:49:52 +01:00
marioalexis
1972dfe5a3 Base: Replace C cast 2022-09-18 11:06:51 -05:00
wmayer
7824d7b1df Base: fix several warnings reported by code analyzers 2022-08-02 13:04:50 +02:00
berniev
8aff4a7503 Base: Modernise ctors dtors defs etc 2022-08-02 12:37:46 +02:00
Uwe
90abdf2752 [Base] remove some more superfluous nullptr checks 2022-07-18 13:07:16 +02:00
Uwe
53571f7196 [Base] remove superfluous nullptr checks 2022-07-18 03:16:22 +02:00
wmayer
1ae55905ba Py: make FreeCAD to compile with Py3.11 2022-07-01 17:54:50 +02:00
wmayer
c955372ecf cppcoreguidelines-pro-type-union-access
According to https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md using union for type-punning is undefined behaviour.
 Replace it with std::memcpy
2022-06-24 14:29:50 +02:00
marioalexis
82da0065c4 Base: Add function to get Python object types for SWIG interfaces 2022-06-21 21:01:37 -04:00
Zheng, Lei
3ef438eaf0 Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
3b42d4afac Base: PR6497 move return statement to new line 2022-03-29 12:34:34 -05:00
wmayer
882e34f2ce Base: modernize C++11
* use nullptr
2022-03-23 16:57:25 +01:00
wmayer
c8edbe0c30 Base: [skip ci] cleaning up modules is only needed for leak detectors 2022-03-20 13:39:22 +01:00
wmayer
d69defaa3c Py: replace BaseExceptionFreeCADError with more suitable exception types 2022-03-17 13:54:23 +01:00
wmayer
a22608b7b5 Base: let interpreter keep track of created modules 2022-03-13 22:34:01 +01:00
wmayer
58a719e207 Base: move ILogger sub-classes to their own source files in order to reduce including stream classes in client code 2022-03-06 10:13:47 +01:00
Uwe
6afab502ca [Base] Geometry etc.: remove unused includes 2022-03-01 13:56:02 +01:00
Uwe
d11d00cb70 [Base] fix typo to silence spellchecker CI 2022-02-22 02:31:51 +01:00
wmayer
44e82ac3c4 App: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:55:56 +02:00
wmayer
af16ab02a0 Base: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:29:48 +02:00
luz paz
142c2c2c4d Base: remove Py2 code 2021-04-26 09:23:58 +02:00
wmayer
df0f979f3b App/Gui: fix memory leaks:
+ add function to cleanup units and quantities in debug build
+ fix reference leak in PropertyVector::getPyPathValue()
+ fix reference leak in PropertyPlacement::getPyPathValue()
+ in InterpreterSingleton::init() use a static std::vector<wchar_t*> instead of a C array
  to free memory at program end
+ in MainWindow::closeEvent() explicitly delete all task watchers
+ in ReportOutputObserver constructor pass parent to QObject
+ in PropertyEditor destructor explicitly delete QItemEditorFactory
2021-02-27 10:56:19 +01:00