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

Inlined defer #311

Merged
merged 9 commits into from
Dec 25, 2023
Merged

Inlined defer #311

merged 9 commits into from
Dec 25, 2023

Conversation

lihuiba
Copy link
Collaborator

@lihuiba lihuiba commented Dec 21, 2023

make DEFER() always inline

@lihuiba lihuiba changed the base branch from main to release/0.7 December 21, 2023 09:23
@lihuiba lihuiba marked this pull request as ready for review December 21, 2023 09:38
@@ -74,25 +74,25 @@ ptr_array_t<T> ptr_array(T* pbegin, size_t n)
return {pbegin, pbegin + n};
}

#define __INLINE__ __attribute__((always_inline))
#define __FORCE_INLINE__ __INLINE__ inline

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wondering why force incline doesn't equal to always inline ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Plain functions need the inline keyword, otherwise the compiler will generates warnings. Whereas lambdas can not have inline. So we have to have 2 macros. Maybe the wording can be improved.

@lihuiba lihuiba merged commit 1c0b39a into alibaba:release/0.7 Dec 25, 2023
7 checks passed
@lihuiba lihuiba deleted the inlined_defer branch January 3, 2024 04:20
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.

None yet

2 participants