-
-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add static assert with auto message #740
add static assert with auto message #740
Conversation
Resolve all C++ -O2 warnings Resolve all C++ -O2 warnings
View changes with SemanticDiff |
* Add include/linux/stringify.h from Linux kernel 2.6.12-rc2 (cherry picked from commit torvalds/linux@1da177e) * Make __stringify support variable argument macros too For example: __stringify(__entry->irq, __entry->ret) will now convert it to: "REC->irq, REC->ret" It also still supports single arguments as the old macro did. Signed-off-by: Zhao Lei <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Cc: Steven Rostedt <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> (cherry picked from commit torvalds/linux@8f7c2c3) * Add documentation. * Adjust names in order to satisfy naming convention. * Use __VA_ARGS__ instead a GNU extension as this works with more compilers. Works with the newest versions of ICCAVR, GCC, CLANG and MSCV. C++11 may be required. * Adjust to ETL folder structure. * Change include guard to the one usual in ETL. * Add definition guard for STRINGIFY. --------- Co-authored-by: Linus Torvalds <[email protected]> Co-authored-by: Zhaolei <[email protected]>
Warning[Pe111]: statement is unreachable
Minor format edit
…le-and-GCC-less-than-11' of https://github.com/ETLCPP/etl into pull-request/ETLCPP#777-Allow-Building-Tests-as-Submodule-and-GCC-less-than-11 # Conflicts: # .github/workflows/clang.yml
…ilding-Tests-as-Submodule-and-GCC-less-than-11' into development
This reverts commit a09efff.
# Conflicts: # support/Release notes.txt
# Conflicts: # support/Release notes.txt
4d6e7a6
to
ff48106
Compare
0b1762b
to
9f5528c
Compare
… 2 arguments. Inspired by https://stackoverflow.com/a/11763277/ Warning: This requires support for variadic macros (`__VA_ARGS__`). These were officially added in C99 and C++11.
9f5528c
to
7771cf3
Compare
(cherry picked from commit 91e7f46)
I rebased this branch in order to make use of the extended workflow settings (3173d7e). |
(cherry picked from commit ae8c19e)
This branch is currently based on 4eb46d6 of branch
The unrelated changes will be removed from this pull request as soon as they will be merged into the target/base branch of this pull request. Alternatively the source branch of this pull request may be rebased onto its merge-base to the target/base branch while omitting the unrelated changes. |
(cherry picked from commit 4d6e7a6)
3392a6c
into
ETLCPP:pull-request/#740-add-static-assert-with-auto-message
I've just managed to get round to looking at this pull request and I noticed that it has a lot of 'co-authors', one at least involved with Linux. Has some of this change been copied from GPL code? Co-authored-by: John Wellbelove [email protected] |
The branch contains some commits which were not supposed to be merged. A rebase is required to remove those, hence I did not mark the pull request as ready for merge. I was not able to finish this pull request as I was not able to use the build pipeline to test the changes (see #784). The only relevant changes for this pull request is the range including [7771cf3 ... ba53a39] (see comparison with parent). Those commits were authored my me. |
Suggested changes:
ETL_STATIC_ASSERT()
for only one argument (condition). That overload does either callstatic_assert()
if C++17 is used or callsETL_STATIC_ASSERT()
where the second (message) argument is generated by stringifying the condition.⚠ Warning: The overload resolution mechanism does use variadic macros (
__VA_ARGS__
). These were officially added in C99 and C++11. When compiling with-std=c++98
modern compilers issue a warning (see example). I also tested it with IAR C/C++ Compiler for AVR 6.70.1 which officially only supports C++98 (Extended Embedded C++), without warnings or errors.In case these changes are accepted, the documentation on the website must be updated.