Skip to content
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

chore: ensure statics are only present once in the final app #5588

Merged
merged 15 commits into from
Sep 14, 2024

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Sep 9, 2024

static shouldn't be used for constants (nor functions) in headers, as this causes them to be compiled separately into every TU they're included in. For small constants, it's not that bad, but for more complex types, this requires initialization for each of these instances (e.g. a QString needs to be constructed by calling into the respective library - LTO can't eliminate this). These constants should be defined as inline, meaning they will essentially be "merged" into a single constant when linking (inline doesn't really mean that the compiler will inline them).

Even though constexpr implies inline for functions, it doesn't imply inline for constants (these will default to static).

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/controllers/filters/lang/Tokenizer.cpp Outdated Show resolved Hide resolved
src/controllers/filters/lang/Tokenizer.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/controllers/filters/lang/Tokenizer.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/controllers/filters/lang/Tokenizer.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/controllers/filters/lang/Tokenizer.hpp Outdated Show resolved Hide resolved
src/widgets/Window.cpp Outdated Show resolved Hide resolved
src/widgets/Window.cpp Outdated Show resolved Hide resolved
src/widgets/Window.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/controllers/filters/lang/Tokenizer.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/controllers/filters/lang/Tokenizer.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

tests/src/Filters.cpp Outdated Show resolved Hide resolved
Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just the one note about the emoji RFC-thing

@pajlada pajlada enabled auto-merge (squash) September 14, 2024 12:09
@pajlada pajlada merged commit 3d06f86 into Chatterino:master Sep 14, 2024
18 checks passed
@Nerixyz Nerixyz deleted the fix/storage branch September 14, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants