mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-02-14 14:29:29 -06:00
fixtypo compiler names
Everywhere cmake, qmake, docs, ...
This commit is contained in:
2
.github/workflows/linux-qt6-drivers.yml
vendored
2
.github/workflows/linux-qt6-drivers.yml
vendored
@@ -97,7 +97,7 @@ jobs:
|
||||
runnerWorkPath=$(realpath "$RUNNER_WORKSPACE/..")
|
||||
echo "TinyRunnerWorkPath=$runnerWorkPath" >> $GITHUB_ENV
|
||||
|
||||
# Parallel gcc to 3 and clang to 8 is maximum what my computer allows but I decided to use
|
||||
# Parallel gcc to 3 and Clang to 8 is maximum what my computer allows but I decided to use
|
||||
# the different strategy, I will use the on: workflow_dispatch for all self-hosted actions
|
||||
# and these workflows are invoked automatically one from other:
|
||||
# gh workflow run --ref silverqx-develop
|
||||
|
||||
2
.github/workflows/msys2-ucrt64.yml
vendored
2
.github/workflows/msys2-ucrt64.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
env:
|
||||
# Settings (constant variables)
|
||||
# First value is a compressed data size
|
||||
# gcc: ~ 180 * 3 + 100 ; clang: ~ 140 * 3 + 100
|
||||
# GCC: ~ 180 * 3 + 100 ; clang: ~ 140 * 3 + 100
|
||||
TINY_CCACHE_MAX_SIZE_GCC: 640M
|
||||
TINY_CCACHE_MAX_SIZE_CLANG: 520M
|
||||
# Clang and vcpkg uses $env:NUMBER_OF_PROCESSORS
|
||||
|
||||
10
NOTES.txt
10
NOTES.txt
@@ -1532,7 +1532,7 @@ inline constants:
|
||||
- related issue: https://github.com/llvm/llvm-project/issues/55938
|
||||
- clang-cl shared build crashes with extern constants, so force to inline constants 😕🤔
|
||||
- don't show INLINE_CONSTANTS cmake option and provide the default value ON using feature_option_dependent(INLINE_CONSTANTS) depends option, so inline constants is the default
|
||||
- so inline constants are only one option with clang-cl
|
||||
- so inline constants are only one option with Clang-cl
|
||||
|
||||
- qmake
|
||||
- normal behavior is that user can switch between inline and extern constants using the inline_constants/extern_constants qmake CONFIG option
|
||||
@@ -1547,12 +1547,12 @@ inline constants:
|
||||
- MinGW clang static build is not supported, contains a problem with duplicit symbols, this build type is disabled
|
||||
- qmake error() is thrown with a nice message
|
||||
- cmake compiles ok but crashes in this scenario
|
||||
- clang-cl shared build crashes with extern constants, so force to inline constants 😕🤔
|
||||
- Clang-cl shared build crashes with extern constants, so force to inline constants 😕🤔
|
||||
- when is shared build then inline_constants qmake CONFIG option is set (this is the default)
|
||||
- when user set extern_constants then qmake error() is thrown with nice message (I have removed this correction logic)
|
||||
- so inline constants are only one option with clang-cl
|
||||
- so inline constants are only one option with Clang-cl
|
||||
|
||||
The conclusion is that the funckin string constants 💥, it was bearable until I have added the clang-cl MSVC support.
|
||||
The conclusion is that the funckin string constants 💥, it was bearable until I have added the Clang-cl MSVC support.
|
||||
Clang under <v18 is full of bugs, the same is true for lld. Huge amount of problems were fixed before 14-18.
|
||||
I think is the time to try Clang libc++ std library again and give it a try, but I don't believe I compile basic code, last time I tried I had a problems with hello world. 😅
|
||||
|
||||
@@ -2623,7 +2623,7 @@ Compilation time and Memory usage:
|
||||
- Qt 6.2.4
|
||||
MSVC2019 9.9GB 1:27
|
||||
MSVC2022 8.0GB 1:25
|
||||
clang-cl MSVC2022 5.5GB 1:35
|
||||
Clang-cl MSVC2022 5.5GB 1:35
|
||||
|
||||
|
||||
bugs:
|
||||
|
||||
@@ -108,13 +108,13 @@ ${TINY_UNPARSED_ARGUMENTS}")
|
||||
|
||||
# clang-cl.exe notes:
|
||||
# /RTC - https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130902/088105.html
|
||||
# /bigobj - clang-cl uses it by default - https://reviews.llvm.org/D12981
|
||||
# /bigobj - Clang-cl uses it by default - https://reviews.llvm.org/D12981
|
||||
if(MSVC)
|
||||
# Common for MSVC and clang-cl
|
||||
# Common for MSVC and Clang-cl
|
||||
target_compile_options(${target} INTERFACE
|
||||
# Suppress banner and info messages
|
||||
/nologo
|
||||
# Is safer to provide this explicitly, qmake do it for msvc too
|
||||
# Is safer to provide this explicitly, qmake do it for MSVC too
|
||||
/EHsc
|
||||
/utf-8
|
||||
# Has to be enabled explicitly
|
||||
@@ -139,7 +139,7 @@ ${TINY_UNPARSED_ARGUMENTS}")
|
||||
# Set by default by c++20 but from VS 16.11, can be removed when
|
||||
# minMsvcReqVersion will be >= 16.11
|
||||
/permissive-
|
||||
# clang-cl 16 throws -Wunused-command-line-argument, so provide it
|
||||
# Clang-cl 16 throws -Wunused-command-line-argument, so provide it
|
||||
# only for the MSVC
|
||||
/guard:cf
|
||||
/bigobj
|
||||
@@ -203,7 +203,7 @@ ${TINY_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
target_compile_options(${target} INTERFACE
|
||||
# -fexceptions for linux is not needed, it is on by default
|
||||
# -fexceptions for Linux is not needed, it is on by default
|
||||
-Wall
|
||||
-Wextra
|
||||
# Weffc++ is outdated, it warnings about bullshits 🤬, even word about this
|
||||
@@ -242,7 +242,7 @@ ${TINY_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use faster lld linker on Clang (target the Clang except clang-cl with MSVC)
|
||||
# Use faster lld linker on Clang (target the Clang except Clang-cl with MSVC)
|
||||
# Don't set for MINGW to avoid duplicate setting (look a few lines above)
|
||||
# TODO use LINKER_TYPE target property when min. version will be CMake v3.29 silverqx
|
||||
if(NOT MINGW AND NOT MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
@@ -39,7 +39,7 @@ Visual Studio")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# clang-cl
|
||||
# Clang-cl
|
||||
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
|
||||
CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"
|
||||
)
|
||||
@@ -50,7 +50,7 @@ Visual Studio")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS TINY_CLANG_CL)
|
||||
message(FATAL_ERROR "Minimum required clang-cl version was not satisfied, \
|
||||
message(FATAL_ERROR "Minimum required Clang-cl version was not satisfied, \
|
||||
required version >=${TINY_CLANG_CL}, your version is ${CMAKE_CXX_COMPILER_VERSION}, \
|
||||
upgrade LLVM")
|
||||
endif()
|
||||
@@ -377,7 +377,7 @@ endfunction()
|
||||
# contains ccache/sccache (fixes for MSVC compilers)
|
||||
function(tiny_should_fix_ccache_msvc out_variable)
|
||||
|
||||
# Target the msvc and clang-cl with msvc compilers on Windows
|
||||
# Target the MSVC and Clang-cl with MSVC compilers on Windows
|
||||
if(NOT WIN32 OR NOT MSVC OR MINGW OR NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
set(${out_variable} FALSE PARENT_SCOPE)
|
||||
return()
|
||||
@@ -392,8 +392,8 @@ function(tiny_should_fix_ccache_msvc out_variable)
|
||||
endfunction()
|
||||
|
||||
# Determine whether to disable PCH based on the ccache --print-version and set
|
||||
# the internal cache variable TINY_CCACHE_VERSION (msvc only)
|
||||
# Precompiled headers are fully supported on msvc for ccache >=4.10, so
|
||||
# the internal cache variable TINY_CCACHE_VERSION (MSVC only)
|
||||
# Precompiled headers are fully supported on MSVC for ccache >=4.10, so
|
||||
# disable PCH for ccache <4.10 only.
|
||||
# The git-ref is a special value, it means that the ccache was built manually from eg.
|
||||
# master branch, in this case suppose the version is always >=4.10.
|
||||
@@ -413,7 +413,7 @@ function(tiny_should_disable_precompile_headers out_variable)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(helpString "Ccache version used to determine whether to disable PCH (msvc only).")
|
||||
set(helpString "Ccache version used to determine whether to disable PCH (MSVC only).")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_CXX_COMPILER_LAUNCHER}" --print-version
|
||||
@@ -624,7 +624,7 @@ endfunction()
|
||||
# contains ccache/sccache (fixes for Clang compilers)
|
||||
function(tiny_should_fix_ccache_clang out_variable)
|
||||
|
||||
# Target the Clang on Linux, MSYS2, and also clang-cl with MSVC
|
||||
# Target the Clang on Linux, MSYS2, and also Clang-cl with MSVC
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(${out_variable} FALSE PARENT_SCOPE)
|
||||
return()
|
||||
@@ -645,7 +645,7 @@ function(tiny_fix_ccache)
|
||||
|
||||
# MSYS2 g++ or clang++ work well with the precompiled headers but the msvc doesn't
|
||||
|
||||
# Fixes for the MSVC compiler (including the clang-cl with MSVC)
|
||||
# Fixes for the MSVC compiler (including the Clang-cl with MSVC)
|
||||
set(shouldFixCcacheMsvc FALSE)
|
||||
tiny_should_fix_ccache_msvc(shouldFixCcacheMsvc)
|
||||
|
||||
@@ -653,7 +653,7 @@ function(tiny_fix_ccache)
|
||||
tiny_fix_ccache_msvc()
|
||||
endif()
|
||||
|
||||
# Fixes for the Clang compiler on Linux, MSYS2, and also clang-cl with MSVC
|
||||
# Fixes for the Clang compiler on Linux, MSYS2, and also Clang-cl with MSVC
|
||||
# Ignore PCH timestamps if the ccache is used (recommended in ccache docs)
|
||||
set(shouldFixCcacheClang FALSE)
|
||||
tiny_should_fix_ccache_clang(shouldFixCcacheClang)
|
||||
|
||||
@@ -2,8 +2,8 @@ include(TinyFeatureOptions)
|
||||
|
||||
# Initialize INLINE_CONSTANTS CMake feature dependent option.
|
||||
# MinGW Clang shared build crashes with inline constants (fixed in Clang v18).
|
||||
# clang-cl shared build crashes with extern constants so force to inline constants 😕🤔
|
||||
# (also fixed in Clang v18), only one option with the clang-cl is inline constants
|
||||
# Clang-cl shared build crashes with extern constants so force to inline constants 😕🤔
|
||||
# (also fixed in Clang v18), only one option with the Clang-cl is inline constants
|
||||
# for both shared/static builds.
|
||||
# Look at NOTES.txt[inline constants] how this funckin machinery works. 😎
|
||||
# Related issue: https://github.com/llvm/llvm-project/issues/55938
|
||||
|
||||
@@ -32,7 +32,7 @@ ${TINY_UNPARSED_ARGUMENTS}")
|
||||
)
|
||||
|
||||
# These two settings allow to run tests in parallel using eg.: ctest --parallel 10
|
||||
# Parallel 30 saves ~12s on msvc (from 42s to 30s)
|
||||
# Parallel 30 saves ~12s on MSVC (from 42s to 30s)
|
||||
set_tests_properties(${name} PROPERTIES RUN_SERIAL ${TINY_RUN_SERIAL})
|
||||
|
||||
# Primarily to depend all functional tests on unit tests
|
||||
|
||||
@@ -511,7 +511,7 @@ target_link_libraries(${Tom_target}
|
||||
|
||||
### Build migrations {#build-migrations-cmake}
|
||||
|
||||
Now you are ready to configure `tom` `CMake` application. Don't forget to prepare the build environment with the [`qtenv6.ps1`](building/tinyorm.mdx#windows-prerequisites) command if you are building with the `msvc`.
|
||||
Now you are ready to configure `tom` `CMake` application. Don't forget to prepare the build environment with the [`qtenv6.ps1`](building/tinyorm.mdx#windows-prerequisites) command if you are building with the `MSVC`.
|
||||
|
||||
```bash
|
||||
cd ../tom-builds-cmake/build-debug
|
||||
|
||||
@@ -905,7 +905,7 @@ These variables will be set after the configuration is done:
|
||||
| ----------------------------- | ----------- |
|
||||
| `TINY_BUILD_SUBFOLDER` | Folder by release type if `CONFIG+=debug_and_release` is defined <small>(/debug, /release, or an empty string)</small>. |
|
||||
| `TINY_CCACHE_BUILD` | To correctly link `ccache` build against a `ccache` build <small>(_ccache or an empty string)</small>. |
|
||||
| `TINY_MSVC_VERSION` | The `msvc` compiler string <small>(MSVC2022 or MSVC2019)</small>. |
|
||||
| `TINY_MSVC_VERSION` | The `MSVC` compiler string <small>(MSVC2022 or MSVC2019)</small>. |
|
||||
| `TINY_QT_VERSION_UNDERSCORED` | Underscored `Qt` version <small>(eg. 6_7_2)</small>. |
|
||||
| `TINY_RELEASE_TYPE_CAMEL` | Build type string <small>(Debug, Profile, or Release)</small>. |
|
||||
| `TINY_VCPKG_INCLUDE` | Path to the `vcpkg` `include` folder <small>(vcpkg/installed/<triplet>/include/)</small>. |
|
||||
@@ -1013,7 +1013,7 @@ On Linux `-isystem` marks the directory as a system directory, it prevents warni
|
||||
|
||||
On Windows you can use `QMAKE_CXXFLAGS_WARN_ON = -external:anglebrackets -external:W0`, it applies a warning level 0 to the angel bracket includes; `#include <file>`.
|
||||
|
||||
With the `clang-cl` with `MSVC` you can use `-imsvc`.
|
||||
With the `Clang-cl` with `MSVC` you can use `-imsvc`.
|
||||
:::
|
||||
|
||||
### Auto-configuration internals
|
||||
|
||||
@@ -18,7 +18,7 @@ Following compilers are backed up by the GitHub Action [workflows](https://githu
|
||||
- MSVC 2022 `>=17`
|
||||
- MSYS2 UCRT64 GCC `10.2` - `14.1`
|
||||
- MSYS2 UCRT64 Clang `>=15`
|
||||
- clang-cl `>=15` with MSVC 2019/2022
|
||||
- Clang-cl `>=15` with MSVC 2019/2022
|
||||
|
||||
#### `Linux`
|
||||
|
||||
|
||||
@@ -240,8 +240,8 @@ Attributes that are `null` __will also be__ cast so that the `QVariant`'s intern
|
||||
|
||||
By default, TinyORM will cast the `created_at` and `updated_at` columns to instances of `QDateTime`. You may cast additional date attributes by defining additional date casts within your model's `u_casts` static data member unordered map. Typically, dates should be cast using the `CastType::QDateTime`, `CastType::QDate`, or `CastType::Timestamp` cast types.
|
||||
|
||||
When a database column is of the date type, you may set the corresponding model attribute value to a UNIX timestamp, date string (`Y-m-d`), date-time string, `QDate`, or `QDateTime` instance. The date's value will be correctly converted and stored in your database.<br/>
|
||||
The same is true for the datetime or timestamp database column types, you can set the corresponding model attribute value to a UNIX timestamp, date-time string, or a `QDateTime` instance.
|
||||
When a database column is of the date type, you may set the corresponding model attribute value to a Unix timestamp, date string (`Y-m-d`), date-time string, `QDate`, or `QDateTime` instance. The date's value will be correctly converted and stored in your database.<br/>
|
||||
The same is true for the datetime or timestamp database column types, you can set the corresponding model attribute value to a Unix timestamp, date-time string, or a `QDateTime` instance.
|
||||
|
||||
When defining the `CastType::QDate` or `CastType::QDateTime` cast, you may also specify the date's format. In this case you must use the `CastType::CustomQDate` or `CastType::CustomQDateTime` cast types. This format will be used when the [model is serialized to a vector, map, or JSON](tinyorm/serialization.mdx):
|
||||
|
||||
@@ -279,7 +279,7 @@ To specify the format that should be used when actually storing a model's dates
|
||||
inline static QString u_dateFormat {QLatin1Char('U')};
|
||||
```
|
||||
|
||||
This format can be any format that the QDateTime's `fromString` or `toString` methods accept or the special `U` format that represents the UNIX timestamp (this `U` format is TinyORM-specific and isn't supported by `QDateTime`).
|
||||
This format can be any format that the QDateTime's `fromString` or `toString` methods accept or the special `U` format that represents the Unix timestamp (this `U` format is TinyORM-specific and isn't supported by `QDateTime`).
|
||||
|
||||
Define a `u_timeFormat` data member on your model to specify the format that should be used when storing a model's times within your database:
|
||||
|
||||
|
||||
@@ -270,15 +270,15 @@ The default value for datetime or timestamp columns is `yyyy-MM-dd HH:mm:ss` and
|
||||
|
||||
##### Unix timestamps
|
||||
|
||||
You can set the `u_dateFormat` to `U` if you want to store dates in the database as unix timestamps:
|
||||
You can set the `u_dateFormat` to `U` if you want to store dates in the database as Unix timestamps:
|
||||
|
||||
```cpp
|
||||
QString u_dateFormat {QLatin1Char('U')};
|
||||
```
|
||||
|
||||
In this case __all__ date attributes set in the `u_dates` will be handled as unix timestamps, so also the `created_at` and `updated_at` timestamp attributes.
|
||||
In this case __all__ date attributes set in the `u_dates` will be handled as Unix timestamps, so also the `created_at` and `updated_at` timestamp attributes.
|
||||
|
||||
To create unix timestamp columns using the [tom migrations](/database/migrations.mdx) you should use `integer` types:
|
||||
To create Unix timestamp columns using the [tom migrations](/database/migrations.mdx) you should use `integer` types:
|
||||
|
||||
```cpp
|
||||
Schema::table("flights", [](Blueprint &table)
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#if defined(TINYDRIVERS_EXTERN_CONSTANTS) && defined(TINYDRIVERS_INLINE_CONSTANTS)
|
||||
# error Both TINYDRIVERS_EXTERN_CONSTANTS and TINYDRIVERS_INLINE_CONSTANTS defined.
|
||||
#endif
|
||||
/* clang-cl shared build crashes with extern constants, force to inline constants. 😕🤔
|
||||
Only one option with the clang-cl is inline constants for both shared/static builds.
|
||||
/* Clang-cl shared build crashes with extern constants, force to inline constants. 😕🤔
|
||||
Only one option with the Clang-cl is inline constants for both shared/static builds.
|
||||
Look at NOTES.txt[inline constants] how this funckin machinery works. 😎 */
|
||||
#if !defined(TINYDRIVERS_INLINE_CONSTANTS) && defined(_MSC_VER) && defined(__clang__)
|
||||
# undef TINYDRIVERS_EXTERN_CONSTANTS
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for msvc >=Qt6 and UTF-8 in any other case
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for MSVC >=Qt6 and UTF-8 in any other case
|
||||
|
||||
//IDI_ICON1 ICON "icons/@TinyMySql_target@.ico"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ TINY_SYSTEM_HEADER
|
||||
// Used compiler
|
||||
// Must be before GNU, because clang claims to be GNU too
|
||||
#ifdef __clang__
|
||||
// Apple clang has other version numbers
|
||||
// Apple Clang has other version numbers
|
||||
# ifdef __apple_build_version__
|
||||
# define TINYORM_COMPILER_STRING "Clang " __clang_version__ " (Apple)"
|
||||
# else
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace Orm::SchemaNs
|
||||
I have decided not to use polymorphic commands, I wanted to use
|
||||
designated initializers with aggregates, the consequence of this is
|
||||
usage of reinterpret_cast() :/, but it works great.
|
||||
I had to reject designated initializers with commands because of gcc throws
|
||||
I had to reject designated initializers with commands because of GCC throws
|
||||
-Wmissing-field-initializers warning with aggregates that have a base class
|
||||
even empty base class, so I had to use classic aggregate initialization with
|
||||
commands, it's not a big deal as all data members of commands have to be
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace Orm::Tiny::Concerns
|
||||
inline QDate asDate(const QVariant &value) const;
|
||||
/*! Return a timestamp as QTime object. */
|
||||
inline QTime asTime(const QVariant &value) const;
|
||||
/*! Return a timestamp as unix timestamp. */
|
||||
/*! Return a timestamp as Unix timestamp. */
|
||||
inline qint64 asTimestamp(const QVariant &value) const;
|
||||
|
||||
/*! Return a timestamp as QDateTime or QDate object. */
|
||||
@@ -1040,7 +1040,7 @@ namespace Orm::Tiny::Concerns
|
||||
if (value.isNull())
|
||||
return nullFor_fromDateTime(value, format);
|
||||
|
||||
// Support unix timestamps
|
||||
// Support Unix timestamps
|
||||
if (format == QLatin1Char('U')) T_UNLIKELY
|
||||
return asTimestamp(value);
|
||||
|
||||
@@ -1069,8 +1069,8 @@ namespace Orm::Tiny::Concerns
|
||||
|
||||
const auto &format = getDateFormat();
|
||||
|
||||
// Support unix timestamps
|
||||
/* This should be templated and for the unix timestamps the return type should be
|
||||
// Support Unix timestamps
|
||||
/* This should be templated and for the Unix timestamps the return type should be
|
||||
qint64, but it would make the code more complex because I would have to move
|
||||
the getDateFormat() outside, so I will simply return QString, it's not a big
|
||||
deal, INSERT/UPDATE clauses with '1604xxx' for the bigint columns are totaly
|
||||
@@ -1716,9 +1716,9 @@ namespace Orm::Tiny::Concerns
|
||||
|
||||
const auto valueString = value.value<QString>();
|
||||
|
||||
/* If this value is an integer, we will assume it is a UNIX timestamp's value
|
||||
/* If this value is an integer, we will assume it is a Unix timestamp's value
|
||||
and format a QDateTime object from this timestamp. This allows flexibility
|
||||
when defining your date fields as they might be UNIX timestamps here. */
|
||||
when defining your date fields as they might be Unix timestamps here. */
|
||||
if (StringUtils::isNumber(valueString))
|
||||
// TODO switch ms accuracy? For the u_dateFormat too? silverqx
|
||||
if (auto unixTimestamp = QDateTime::fromSecsSinceEpoch(value.value<qint64>());
|
||||
@@ -2616,7 +2616,7 @@ namespace Orm::Tiny::Concerns
|
||||
if (isCustomDateCastType(castItem)) {
|
||||
const auto castModifier = castItem.modifier().template value<QString>();
|
||||
|
||||
// Support unix timestamps
|
||||
// Support Unix timestamps
|
||||
if (castModifier == QLatin1Char('U')) {
|
||||
value = asTimestamp(value);
|
||||
return;
|
||||
|
||||
@@ -2207,7 +2207,7 @@ TINYORM_END_COMMON_NAMESPACE
|
||||
// CUR cmake/qmake run tests in parallel for tests that allow it silverqx
|
||||
// CUR study how to use acquire/release memory order for m_queryLogId atomic silverqx
|
||||
// FUTURE divide Query Builder and TinyOrm to own packages (dlls)? think about it 🤔 silverqx
|
||||
// BUG clang on mingw inline static initialization with another static in the same class defined line before, all other compilers (on linux too) works silverqx
|
||||
// BUG clang on mingw inline static initialization with another static in the same class defined line before, all other compilers (on Linux too) works silverqx
|
||||
// CUR docs mdx syntax highlight prism Treeview https://prismjs.com/plugins/treeview/ silverqx
|
||||
// CUR docs IdealImage silverqx
|
||||
// TODO cache static_cast<>(*this) in the model()/basemodel() CRTP as a class data member std::optional<std::reference_wrapper<Derived>> m_model = std::nullopt, but I will have to create copy ctor to set m_model {std::nullopt}, the same for other similar model() methods like Model::model(), then I can to check if (m_model) and return right away and I will call static_cast or dynamic_cast only once for every instance, it is cast everytime now 😟 silverqx
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Utils
|
||||
std::invoke(callback, value);
|
||||
|
||||
/* forward not needed, also the std::move() would be ok (treated by constraint),
|
||||
forward prevents clang warning. */
|
||||
forward prevents Clang warning. */
|
||||
return std::forward<T>(value);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Utils
|
||||
std::invoke(callback);
|
||||
|
||||
/* forward not needed, also the std::move() would be ok (treated by constraint),
|
||||
forward prevents clang warning. */
|
||||
forward prevents Clang warning. */
|
||||
return std::forward<T>(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,10 +83,10 @@ namespace Orm::Utils
|
||||
code. */
|
||||
static QString
|
||||
classPureBasenameInternal(const char *typeName, bool withNamespace);
|
||||
/*! Class name with or w/o a namespace and w/o template parameters, msvc code. */
|
||||
/*! Class name with or w/o a namespace and w/o template parameters, MSVC code. */
|
||||
static QString
|
||||
classPureBasenameMsvc(const QString &className, bool withNamespace);
|
||||
/*! Class name with or w/o a namespace and w/o template parameters, gcc code. */
|
||||
/*! Class name with or w/o a namespace and w/o template parameters, GCC code. */
|
||||
static QString
|
||||
classPureBasenameGcc(const QString &className, bool withNamespace);
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
# - TINY_BUILD_SUBFOLDER - Folder by release type if CONFIG+=debug_and_release is defined (/debug, /release, or an empty string).
|
||||
# - TINY_CCACHE_BUILD - To correctly link ccache build against a ccache build (_ccache or an empty string).
|
||||
# - TINY_MSVC_VERSION - Msvc compiler string (MSVC2022 or MSVC2019).
|
||||
# - TINY_MSVC_VERSION - MSVC compiler string (MSVC2022 or MSVC2019).
|
||||
# - TINY_QT_VERSION_UNDERSCORED - Underscored Qt version (eg. 6_7_2).
|
||||
# - TINY_RELEASE_TYPE_CAMEL - Build type string (Debug, Profile, or Release).
|
||||
# - TINY_VCPKG_INCLUDE - Path to the vcpkg include folder (vcpkg/installed/<triplet>/include/).
|
||||
|
||||
@@ -63,5 +63,5 @@ mingw|if(unix:!macx): include($$PWD/unixconf.pri)
|
||||
!if(win32|macx|if(mingw|if(unix:!macx))): \
|
||||
message( "Unsupported platform ($${QMAKE_PLATFORM}-$${QMAKE_COMPILER})." )
|
||||
|
||||
# Enable colors and ANSI escape codes in diagnostics (works also with clang-cl)
|
||||
# Enable colors and ANSI escape codes in diagnostics (works also with Clang-cl)
|
||||
llvm: QMAKE_CXXFLAGS *= -fansi-escape-codes -fcolor-diagnostics
|
||||
|
||||
@@ -27,7 +27,7 @@ if(win32-msvc|win32-clang-msvc): \
|
||||
versionAtMost(QT_MAJOR_VERSION, 5): \
|
||||
DEFINES *= _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
|
||||
|
||||
# Latest qmake's msvc fixes
|
||||
# Latest qmake's MSVC fixes
|
||||
# ---
|
||||
win32-msvc {
|
||||
greaterThan(QMAKE_MSC_VER, 1909) {
|
||||
@@ -86,12 +86,12 @@ win32-msvc {
|
||||
|
||||
# clang-cl.exe notes:
|
||||
# /RTC - https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130902/088105.html
|
||||
# /bigobj - clang-cl uses it by default - https://reviews.llvm.org/D12981
|
||||
# /bigobj - Clang-cl uses it by default - https://reviews.llvm.org/D12981
|
||||
win32-clang-msvc {
|
||||
QMAKE_CXXFLAGS_WARN_ON = -W4
|
||||
|
||||
# Relative paths in -Yu or -Fp are throwing -Wmicrosoft-include warning on clang-cl
|
||||
# with msvc, but not all, only if it contains more ../../, eg. 5 levels up, this is
|
||||
# Relative paths in -Yu or -Fp are throwing -Wmicrosoft-include warning on Clang-cl
|
||||
# with MSVC, but not all, only if it contains more ../../, eg. 5 levels up, this is
|
||||
# happening especially for auto tests which have deep folder structure.
|
||||
precompile_header: \
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-microsoft-include
|
||||
@@ -112,7 +112,7 @@ win32-msvc|win32-clang-msvc {
|
||||
QMAKE_LFLAGS += /guard:cf
|
||||
# Abort linking on warnings for Debug builds only, Release builds must go on as far as possible
|
||||
QMAKE_LFLAGS_DEBUG += /WX
|
||||
# Looks like clang-cl does know nothing about these, for now enabling
|
||||
# Looks like Clang-cl does know nothing about these, for now enabling
|
||||
QMAKE_LFLAGS_RELEASE += /OPT:REF,ICF=5
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Fixed in Clang v18
|
||||
!build_pass:win32-clang-msvc:versionAtMost(TINY_COMPILER_VERSION, 17): \
|
||||
error( "extern constants (extern_constants CONFIG option) cause crashes with\
|
||||
the shared library on clang-cl MSVC <18, please use\
|
||||
the shared library on Clang-cl MSVC <18, please use\
|
||||
\"CONFIG += inline_constants\" instead or leave it undefined." )
|
||||
|
||||
CONFIG -= inline_constants
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Determine whether to disable PCH based on the ccache --print-version and set
|
||||
# the internal cache variable TINY_CCACHE_VERSION (msvc only)
|
||||
# Precompiled headers are fully supported on msvc for ccache >=4.10, so
|
||||
# the internal cache variable TINY_CCACHE_VERSION (MSVC only)
|
||||
# Precompiled headers are fully supported on MSVC for ccache >=4.10, so
|
||||
# disable PCH for ccache <4.10 only.
|
||||
# The git-ref is a special value, it means that the ccache was built manually from eg.
|
||||
# master branch, in this case suppose the version is always >=4.10.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Populate the TINY_COMPILER_VERSION and TINY_SIMULATED_VERSION qmake variables
|
||||
|
||||
# Don't return if it's the clang-cl compiler because we have to manually obtain
|
||||
# Don't return if it's the Clang-cl compiler because we have to manually obtain
|
||||
# the compiler version.
|
||||
!win32-clang-msvc: \
|
||||
!isEmpty(TINY_COMPILER_VERSION): \
|
||||
@@ -49,7 +49,7 @@ else:win32-msvc|win32-clang-msvc {
|
||||
# Ok, to be absolutely correct 😎
|
||||
TINY_COMPILER_VERSION = $$tinyClangClCompilerVersion
|
||||
# Some compilers simulate other compilers to serve as drop-in replacements
|
||||
# Eg. clang-cl simulates MSVC compiler
|
||||
# Eg. Clang-cl simulates MSVC compiler
|
||||
TINY_SIMULATED_VERSION = $$QMAKE_MSC_VER
|
||||
unset(tinyClangClCompilerVersion)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ defineTest(tiny_find_mysql_win32) {
|
||||
export(LIBS_PRIVATE)
|
||||
}
|
||||
|
||||
# Find the MySQL C library for UNIX platform.
|
||||
# Find the MySQL C library for Unix platform.
|
||||
defineTest(tiny_find_mysql_unix) {
|
||||
# MySQL C library
|
||||
# Find with pkg-config (preferred)
|
||||
|
||||
@@ -88,7 +88,7 @@ defineReplace(tiny_configure_cmake_rc) {
|
||||
# The core of the problem is in the $$cat() and write_file() qmake functions they
|
||||
# don't know process UTF-8 encoded files, they use the ANSI encoding.
|
||||
# Few weeks later: I don't understand how the heck is possible that it works with
|
||||
# the msvc Qt5.
|
||||
# the MSVC Qt5.
|
||||
greaterThan(QT_MAJOR_VERSION, 5): \
|
||||
pragmaCodepage = DEFAULT
|
||||
else: \
|
||||
|
||||
@@ -14,7 +14,7 @@ else: \
|
||||
# they are tagged as -internal-isystem, tagging them as -isystem causes the error above.
|
||||
# On MSYS2 with Qt6 are includes in the C:/msys64/ucrt64/include/qt6/ so tagging them
|
||||
# as -isystem is needed.
|
||||
# On unix and also clang-cl with msvc it is needed to avoid warnings from system headers.
|
||||
# On Unix and also Clang-cl with MSVC it is needed to avoid warnings from system headers.
|
||||
!if(mingw:versionAtMost(QT_MAJOR_VERSION, 5)): \
|
||||
QMAKE_CXXFLAGS += $$optionToken $$shell_quote($$[QT_INSTALL_HEADERS]/)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# The cross-platform INCLUDEPATH, use the -isystem on MinGW and Unix, the -imsvc
|
||||
# on clang-cl with MSVC, otherwise, use only the INCLUDEPATH. The INCLUDEPATH is set
|
||||
# on Clang-cl with MSVC, otherwise, use only the INCLUDEPATH. The INCLUDEPATH is set
|
||||
# in all cases.
|
||||
defineTest(tiny_add_system_includepath) {
|
||||
systemIncludePathsRaw = $$1
|
||||
@@ -24,7 +24,7 @@ defineTest(tiny_add_system_includepath) {
|
||||
# MSVC and others
|
||||
includePaths += $$quote($$systemIncludePath)
|
||||
|
||||
# clang-cl with MSVC
|
||||
# Clang-cl with MSVC
|
||||
win32-clang-msvc: \
|
||||
systemIncludePaths += -imsvc $$shell_quote($$systemIncludePath)
|
||||
|
||||
@@ -43,13 +43,13 @@ defineTest(tiny_add_system_includepath) {
|
||||
# QtCreator code completion depends on it, so it must be set in all cases, even
|
||||
# when it's not needed.
|
||||
# Note:
|
||||
# The clang-cl with MSVC also doesn't need the -Ixyz if the -imsvc is set,
|
||||
# The Clang-cl with MSVC also doesn't need the -Ixyz if the -imsvc is set,
|
||||
# it compiles without problems without it, but the QtCreator code completion and
|
||||
# syntax highlighting is corrupted without it.
|
||||
INCLUDEPATH += $$includePaths
|
||||
export(INCLUDEPATH)
|
||||
|
||||
# clang-cl with MSVC, Unix, or MinGW
|
||||
# Clang-cl with MSVC, Unix, or MinGW
|
||||
win32-clang-msvc|unix|win32-g++|win32-clang-g++ {
|
||||
QMAKE_CXXFLAGS += $$systemIncludePaths
|
||||
export(QMAKE_CXXFLAGS)
|
||||
|
||||
@@ -19,7 +19,7 @@ if(win32-msvc|win32-clang-msvc) {
|
||||
!build_pass: \
|
||||
win32-clang-msvc: \
|
||||
!versionAtLeast(TINY_COMPILER_VERSION, $$tinyMinReqClangCl): \
|
||||
error( "Minimum required clang-cl version was not satisfied, required version\
|
||||
error( "Minimum required Clang-cl version was not satisfied, required version\
|
||||
>=$${tinyMinReqClangCl}, your version is $${TINY_COMPILER_VERSION},\
|
||||
upgrade LLVM." )
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ else:CONFIG(release, debug|release): \
|
||||
else: \
|
||||
TINY_RELEASE_TYPE_CAMEL = Release
|
||||
|
||||
# Msvc compiler string (MSVC2022 or MSVC2019)
|
||||
# MSVC compiler string (MSVC2022 or MSVC2019)
|
||||
greaterThan(QMAKE_MSC_VER, 1929): \
|
||||
TINY_MSVC_VERSION = MSVC2022
|
||||
else: \
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
# - TINY_BUILD_SUBFOLDER - Folder by release type if CONFIG+=debug_and_release is defined (/debug, /release, or an empty string).
|
||||
# - TINY_CCACHE_BUILD - To correctly link ccache build against a ccache build (_ccache or an empty string).
|
||||
# - TINY_MSVC_VERSION - Msvc compiler string (MSVC2022 or MSVC2019).
|
||||
# - TINY_MSVC_VERSION - MSVC compiler string (MSVC2022 or MSVC2019).
|
||||
# - TINY_QT_VERSION_UNDERSCORED - Underscored Qt version (eg. 6_7_2).
|
||||
# - TINY_RELEASE_TYPE_CAMEL - Build type string (Debug, Profile, or Release).
|
||||
# - TINY_VCPKG_INCLUDE - Path to the vcpkg include folder (vcpkg/installed/<triplet>/include/).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for msvc >=Qt6 and UTF-8 in any other case
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for MSVC >=Qt6 and UTF-8 in any other case
|
||||
|
||||
IDI_ICON1 ICON "icons/@TinyOrm_target@.ico"
|
||||
|
||||
|
||||
@@ -125,9 +125,9 @@ std::optional<QDate> SqlQuery::asDate(const QString &value)
|
||||
std::optional<QDateTime> SqlQuery::asDateTime(const QString &value) const
|
||||
{
|
||||
// FUTURE datetime, apply this only if the return_qdatetime will support column names, so apply it only for the defined columns silverqx
|
||||
/* If this value is an integer, we will assume it is a UNIX timestamp's value
|
||||
/* If this value is an integer, we will assume it is a Unix timestamp's value
|
||||
and format a QDateTime object from this timestamp. This allows flexibility
|
||||
when defining your date fields as they might be UNIX timestamps here. */
|
||||
when defining your date fields as they might be Unix timestamps here. */
|
||||
// if (StringUtils::isNumber(valueString))
|
||||
// // TODO switch ms accuracy? For the u_dateFormat too? silverqx
|
||||
// if (auto date = QDateTime::fromSecsSinceEpoch(value.value<qint64>());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for msvc >=Qt6 and UTF-8 in any other case
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for MSVC >=Qt6 and UTF-8 in any other case
|
||||
|
||||
//IDI_ICON1 ICON "icons/@TinyUtils_target@.ico"
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ private Q_SLOTS:
|
||||
/* Touching timestamps */
|
||||
void addTouch_setTouchedRelations_getTouchedRelations_touches_clearTouches() const;
|
||||
|
||||
/* Attributes - unix timestamps */
|
||||
/* Attributes - Unix timestamps */
|
||||
void getAttribute_UnixTimestamp_With_UDates() const;
|
||||
void getAttribute_UnixTimestamp_WithOut_UDates() const;
|
||||
|
||||
@@ -1799,7 +1799,7 @@ tst_Model::addTouch_setTouchedRelations_getTouchedRelations_touches_clearTouches
|
||||
QVERIFY(std::addressof(torrent.getTouchedRelations()) == std::addressof(touches));
|
||||
}
|
||||
|
||||
/* Attributes - unix timestamps - u_dateFormat = 'U' */
|
||||
/* Attributes - Unix timestamps - u_dateFormat = 'U' */
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ file(GENERATE OUTPUT "${TINY_BUILD_GENDIR}/include/versionsdebug_cmake-$<CONFIG>
|
||||
NEWLINE_STYLE UNIX
|
||||
)
|
||||
|
||||
# Following commented code throws warning with clang-cl:
|
||||
# Following commented code throws warning with Clang-cl:
|
||||
# warning: definition of macro 'TINYTEST_VERSIONS_VERSIONSDEBUG' does not match definition
|
||||
# in precompiled header [-Wclang-cl-pch]
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ private Q_SLOTS:
|
||||
void touch_CustomColumn() const;
|
||||
void touch_NotUsesTimestamps() const;
|
||||
|
||||
/* Attributes - unix timestamps - u_dateFormat = 'U' */
|
||||
/* Attributes - Unix timestamps - u_dateFormat = 'U' */
|
||||
void setAttribute_UnixTimestamp_With_UDates_UDateFormat() const;
|
||||
void setAttribute_UnixTimestamp_With_UDates_Without_UDateFormat() const;
|
||||
void setAttribute_UnixTimestamp_WithOut_UDates() const;
|
||||
@@ -217,7 +217,7 @@ void tst_MySql_TinyBuilder::touch_NotUsesTimestamps() const
|
||||
QCOMPARE(query, std::nullopt);
|
||||
}
|
||||
|
||||
/* Attributes - unix timestamps - u_dateFormat = 'U' */
|
||||
/* Attributes - Unix timestamps - u_dateFormat = 'U' */
|
||||
|
||||
void tst_MySql_TinyBuilder::setAttribute_UnixTimestamp_With_UDates_UDateFormat() const
|
||||
{
|
||||
@@ -281,7 +281,7 @@ void tst_MySql_TinyBuilder::
|
||||
// Prepare without u_dateFormat but with u_dates
|
||||
Role_CustomUDate::u_dates = QStringList {"added_on"};
|
||||
/* Expected format without u_dateFormat is - 2022-08-03 15:36:56 UTC, even if
|
||||
the input is the unix timestamp. */
|
||||
the input is the Unix timestamp. */
|
||||
auto expectedTimestamp = QDateTime::fromSecsSinceEpoch(timestamp, TTimeZone::UTC)
|
||||
.toString(Role_CustomUDate()
|
||||
.setConnection(m_connection)
|
||||
@@ -332,7 +332,7 @@ void tst_MySql_TinyBuilder::setAttribute_UnixTimestamp_WithOut_UDates() const
|
||||
// QDateTime
|
||||
{
|
||||
/* Expected format without u_dateFormat is - 2022-08-03 15:36:56 UTC, even if
|
||||
the input is the unix timestamp. */
|
||||
the input is the Unix timestamp. */
|
||||
auto expectedTimestamp = QDateTime::fromSecsSinceEpoch(timestamp, TTimeZone::UTC)
|
||||
.toString(Role_CustomUDate()
|
||||
.setConnection(m_connection)
|
||||
|
||||
@@ -308,7 +308,7 @@ private:
|
||||
for the tst_model.pro test case was 800MB, when I only left some of these relations,
|
||||
eg. in the User or TorrentPreviewableFile models then the memory usage was 1.1GB.
|
||||
The conclusion is that recursive #include-s don't increase memory usage during
|
||||
compilation (for msvc compiler, other compilers can behave differently but can be
|
||||
compilation (for MSVC compiler, other compilers can behave differently but can be
|
||||
expected a similar behavior) but model classes themself are increasing memory usage.
|
||||
This finding is surprising for me because I thought that these recursive #include-s
|
||||
are increasing the memory usage too. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for msvc >=Qt6 and UTF-8 in any other case
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for MSVC >=Qt6 and UTF-8 in any other case
|
||||
|
||||
//IDI_ICON1 ICON "icons/@TinyTest_icon@.ico"
|
||||
|
||||
|
||||
4
tests/testdata/create_and_seed_database.php
vendored
4
tests/testdata/create_and_seed_database.php
vendored
@@ -151,9 +151,9 @@ function createTables(string $connection): void
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
|
||||
// To test unix timestamps, u_dateFormat = 'U'
|
||||
// To test Unix timestamps, u_dateFormat = 'U'
|
||||
$table->bigInteger('added_on')->nullable()
|
||||
->comment("To test unix timestamps, u_dateFormat = 'U'");
|
||||
->comment("To test Unix timestamps, u_dateFormat = 'U'");
|
||||
});
|
||||
|
||||
$schema->create('role_user', function (Blueprint $table) {
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace Migrations
|
||||
|
||||
table.string(NAME).unique();
|
||||
|
||||
// To test unix timestamps, u_dateFormat = 'U'
|
||||
// To test Unix timestamps, u_dateFormat = 'U'
|
||||
table.bigInteger("added_on").nullable()
|
||||
.comment("To test unix timestamps, u_dateFormat = 'U'");
|
||||
.comment("To test Unix timestamps, u_dateFormat = 'U'");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ __tom_seeders() {
|
||||
|
||||
[[ -d database/seeders && -f main.cpp ]] || return
|
||||
|
||||
seeder_files=($(/bin/ls database/seeders/*seeder.hpp)) #*/ msvc compile bug workaround
|
||||
seeder_files=($(/bin/ls database/seeders/*seeder.hpp)) #*/ MSVC compile bug workaround
|
||||
|
||||
# Nothing found
|
||||
[[ $#seeder_files -eq 0 ]] && return
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for msvc >=Qt6 and UTF-8 in any other case
|
||||
#pragma code_page(@pragma_codepage@) // DEFAULT for MSVC >=Qt6 and UTF-8 in any other case
|
||||
|
||||
//IDI_ICON1 ICON "icons/@Tom_target@.ico"
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ void Terminal::enableUtf8ConsoleEncoding()
|
||||
/* UTF-8 encoding is corrupted for narrow input functions, needed to use wcin/wstring
|
||||
for an input, input will be in the unicode encoding then needed to translate
|
||||
unicode to utf8, eg. by QString::fromStdWString(), WideCharToMultiByte(), or
|
||||
std::codecvt(). It also works with msys2 ucrt64 gcc/clang. */
|
||||
std::codecvt(). It also works with MSYS2 UCRT64 GCC/Clang. */
|
||||
SetConsoleCP(CP_UTF8);
|
||||
std::ignore = _setmode(_fileno(stdin), _O_WTEXT); // std::ignore to suppress C6031
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user