-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Macro cleanup #6095
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
Macro cleanup #6095
Conversation
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
macOSLinux
Windows
🤖{"platform_name_to_artifacts": {"macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://14419-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.191%2Bg597f3a4c5-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/14419?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://14418-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.191%2Bg597f3a4-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/14418?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://14417-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.191%2Bg597f3a4c5-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/14417?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://14421-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.191%2Bg597f3a4c5-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/14421?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/rcu0cokhboaj2s5y/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/40116047"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/sr4hl22wgwu7cc3v/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/40116047"}]}, "commit_sha": "f568db7f8090f1d93bc7d5a19c40ab75ab8c149c"} |
|
I think |
Yeah, I was kind of uncertain on this one in regards to impact on compile time VS link time. But I couldn't make out any substantial time difference between the two approaches, so I'd go with inlining as well. Makes it easier to use them without accidental linking errors. |
|
Since there are a lot of commits now and they're becoming hard to read, here's a higher-level changelog of all changes so far:
|
Since this is technically a third party library, let's not change anything in here. I'm working with a new upstream fixing a lot and will eventually be removing this folder and using the upstream.
Have you tested this change and made sure it works as before? |
Agreed. Depending on which we want to merge first, I can revert the refactor in portsmf back to the NULL macro, or rebase onto your changes once they've been merged.
Not extensively, I only did a GUI session running some automation. I also ran the test suite, but that never calls into any of these functions. It's not a big deal in this particular instance since the changes are very easy to reason about, but I could add a unit test just to be sure. As for the changes: Hope that eliminates concerns about this change - but of course, a unit test would be better than taking my word for it, so if we can define what the test should look like, I'll add it to the test suite. :) |
|
I wasn't too worried just wanted to make sure the INVAL and those macros changes still worked since we were trying to figure out a good way to replace all the calls. Better solutions are always accepted! 😁 For portsmf, at this point it shouldn't be too much of a problem since the folder will be removed eventually. Your choice to revert or not. |
|
What's the state here? |
|
Some futher work hadn't been pushed yet, but other than that it was left lying around for a bit because I was busy with other things. Over all, a great deal of macros have been replaced now, though, so it might be ready to merge after a few more commits. |
|
Requesting sanity test on Windows for commit ae30a57. Verify that multi-byte character strings are widened correctly in F_OPEN_UTF8. |
|
The following macros have not been replaced in this PR: ladspa.h lmms_basics.h AudioPortAudio.h AutomatableModel.h LmmsPalette.h MemoryManager.h |
SummaryThis is a concise summary of the changes implemented in this PR, listing as many macro replacements as I was able to gather from the commit log and diff. Possible missing items not ruled out, though ;-).
Additionally, in many places, global constants that were declared as Some macros that only appeared in single source files and were unused in those files have been removed entirely. |
9bf2578 to
62e6910
Compare
|
Alas, history hath been rewritten. |
Veratil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't match the previous commit format for other constexpr. In the previous name = value is used while this is using name{value}.
Veratil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I haven't hit a commit that changes this yet, let's change these (float)... C casts to C++ static_cast<float>(...).
Veratil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another name{value}.
|
I just realized this isn't linking the commit I'm commenting on. 😠 |
…h with equivalent functions in AutomationPattern.h
…replace occurences with std::pow
… compile-time evaluable.
…n Alg_seq::operator[] instead of retuning null.
116c827 to
f9818a3
Compare
|
This PR had 2 reviews. Merging in 2 days if no one else is opposed (or merges it before I do). |
As a preamble for larger refactoring tasks, I'm working on replacing C Preprocessor macros throughout the codebase with type-safe C++ constructs, since they are much easier to reason about and the preprocessor is unaware of language semantics.
The main motivation here was the macro
gui, which prevents us from creating anamespace guias currently being discussed in #6086. The purpose of this PR is to replace as many macros as possible with C++ constructs.